Skip to content

Allow custom headers for outputs.prometheus_client #16565

@smuth4

Description

@smuth4

Use Case

We have a security requirement that mandates certain headers be returned on HTTP responses. Currently there is no way to apply these for outputs.prometheus_client, although it appears other plugins have that capability. Ideally it'd be as simple as:

[[outputs.prometheus_client]]
  listen = ":9273"
  http_headers = {"X-Special-Header" = "Special-Value"}
[[inputs.system]]

Expected behavior

$ curl http://localhost:9273 -v |& grep X-Special-Header
< X-Special-Header: Special-Value

Actual behavior

2025-02-27T17:05:25Z E! [telegraf] Error running agent: error loading config file test.conf: plugin outputs.prometheus_client: line 3: configuration specified the fields ["http_headers"], but they weren't used

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new plugin and for new features to existing plugins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions