Skip to content

[exporter/datadog]: fail_on_invalid_key is not respected when API key contains disallowed characters #42677

@ste93cry

Description

@ste93cry

Component(s)

exporter/datadog

What happened?

Description

The Datadog exporter offers a configuration option named fail_on_invalid_key, designed to prevent startup failures when an invalid key is used. If the key fails authentication with the provider, the collector logs the error and proceeds to start successfully. However, commit fae5b26 introduced an additional check to validate the key’s format. This new check does not honor such setting, causing the collector to crash during startup if the API key contains invalid characters.

Steps to Reproduce

Configure the datadog exporter with a key that does not respect the allowed pattern [^a-fA-F0-9] and set fail_on_invalid_key: false

Expected Result

The collector starts successfully, logging the error and ignoring it

Actual Result

The collector crashes with a fatal error during startup time

Collector version

v0.135.0

Environment information

Environment

OS: MacOs

OpenTelemetry Collector configuration

receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318

exporters:
  datadog:
    api:
      fail_on_invalid_key: false
      site: datadoghq.eu
      key: test-api-key

service:
  pipelines:
    metrics:
      receivers: [otlp]
      exporters: [datadog]

Log output

Error: invalid configuration: exporters::datadog: api::key contains invalid characters: invalid characters: t, s, t, -, p, i, -, k, y
2025/09/14 20:18:33 collector server run finished with error: invalid configuration: exporters::datadog: api::key contains invalid characters: invalid characters: t, s, t, -, p, i, -, k, y

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions