šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

github.com/open-telemetry/opentelemetry-collector-contrib/extension/headerssetter

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/open-telemetry/opentelemetry-collector-contrib/extension/headerssetter

v0.62.0
Source
Go
Version published
Created
Source

Headers Setter extension

Status
Stabilityalpha
Distributionscontrib

Deprecated: module github.com/open-telemetry/opentelemetry-collector-contrib/extension/headerssetter is deprecated, use github.com/open-telemetry/opentelemetry-collector-contrib/extension/headerssetterextension instead.

The headers_setter extension implements ClientAuthenticator and is used to set requests headers in gRPC / HTTP exporters with values provided via extension configurations or requests metadata (context).

Use cases include but are not limited to enabling multi-tenancy for observability backends such as Tempo, Mimir, Loki and others by setting the X-Scope-OrgID header to the value extracted from the context.

Configuration

The following settings are required:

  • headers: a list of header configuration objects that specify headers and their value sources. Each configuration object has the following properties:
    • key: the header name
    • value: the header value is looked up from the value property of the extension configuration
    • from_context: the header value is looked up from the request metadata, such as HTTP headers, using the property value as the key (likely a header name)

The value and from_context properties are mutually exclusive.

Configuration Example

extensions:
  headers_setter:
    headers:
      - key: X-Scope-OrgID
        from_context: tenant_id
      - key: User-ID
        value: user_id

receivers:
  otlp:
    protocols:
      http:
        include_metadata: true

processors:
  nop:

exporters:
  loki:
    labels:
      resource:
        container_id: ""
        container_name: ""
    endpoint: https://localhost:<port>/loki/api/v1/push
    auth:
      authenticator: headers_setter

service:
  extensions: [ headers_setter ]
  pipelines:
    traces:
      receivers: [ otlp ]
      processors: [ nop ]
      exporters: [ loki ]

Limitations

At the moment, it is not possible to use the from_context option to ge the header value if Collector's pipeline contains the batch processor. See #4544.

FAQs

Package last updated on 13 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts