Skip to content

Add ability to configure dynamic auth headers #257

@zeitlinger

Description

@zeitlinger

Spec issue: open-telemetry/opentelemetry-specification#1344

The new declarative config doesn't support the use of dynamic auth headers - which is possible now

What would be needed?

A way to update the config model in a customizer with a transient part - i.e. that can't be read from yaml, in this case a function that returns the headers when invoked.

Possible solutions

Placeholder

Use a placehoder syntax to reference system properties (or something similar)

This would have a similar syntax as env vars (see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/data-model.md#environment-variable-substitution)

For example, ${secret:API_KEY} would access a secret storage and we'd have to add setter methods for secrets.

Would roughly work like that

    sectrectStorage.set("GCP", () -> getRequiredHeaderMap(credentials, configProperties));
    add.forEach(
        (key, value) -> {
          if (headers.stream().noneMatch(header -> key.equals(header.getName()))) {
            headers.add(new NameStringValuePairModel().withName("${secret:GCP").withValue(value));
          }
        });

Authentication provider

Make authentication provider a top-level construct - like it already is for otel collector: https://opentelemetry.io/docs/collector/building/authenticator-extension/

The config would be

exporter:
  otlp_http: 
    auth:
      authenticator: 
        gcp:
          region: foo #provider specific settings here

is similar to collector today, e.g.

receivers:
  otlp/auth:
    protocols:
      grpc:
         endpoint: 0.0.0.0:4317
         auth:
           authenticator: oidc

Prior Art / Related

Collector

Collector uses a server interface that is similar (only has the go typical context added): https://github.com/open-telemetry/opentelemetry-collector/blob/main/extension/extensionauth/server.go

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions