Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/datadog] Remove builtin support for environment variable detection #8396

Closed
Tracked by #8372
mx-psi opened this issue Mar 14, 2022 · 0 comments · Fixed by #12110
Closed
Tracked by #8372

[exporter/datadog] Remove builtin support for environment variable detection #8396

mx-psi opened this issue Mar 14, 2022 · 0 comments · Fixed by #12110
Labels
exporter/datadog Datadog components

Comments

@mx-psi
Copy link
Member

mx-psi commented Mar 14, 2022

What will change?

The Datadog exporter currently detects some DD_ prefixed environment variables and sets the value of some configuration settings from its value automatically. For example, if you set your API key on the DD_API_KEY environment variable, the exporter will use it automatically.

To be consistent with the rest of Collectors components, support for this automatic detection is being removed, in favor of explicitly declaring the environment variable holding a configuration value (see next sections for details).

Full list of environment variables which will not be automatically detected in the future (click to expand)
  • DD_API_KEY
  • DD_SITE
  • DD_HOST
  • DD_ENV
  • DD_SERVICE
  • DD_VERSION
  • DD_TAGS
  • DD_URL
  • DD_APM_URL

Who is affected?

If you use one of the environment variables above but do not explicitly declare them in the configuration, you are affected. If you are using it, a warning will be logged for each environment variable that you are using, together with a link to this issue.

An example warning when using DD_API_KEY without setting it explicitly:

Deprecated: "api.key" will not default to "DD_API_KEY"'s value starting on v0.50.0. Set api.key: ${DD_API_KEY} to remove this warning 
Deprecated: see github.com/open-telemetry/opentelemetry-collector-contrib/issues/8396 for more details

What should I do if I am affected?

You need to set the environment variable explicitly on the configuration by using the ${} syntax. If using the DD_TAGS environment variable, you need to use an env configuration source instead.

Example with DD_API_KEY and DD_HOST (click to expand)

If you have the following configuration for the Datadog exporter:

# ...
exporters:
  datadog:
    api:
      site: datadoghq.eu
# ...

and you set the environment variables DD_API_KEY and DD_HOST on the Collector's environment, you need to update your configuration to look as follows:

# ...
exporters:
  datadog:
    api:
      # ⬇️ New ⬇️
      key: ${DD_API_KEY}
      site: datadoghq.eu

    # ⬇️ New ⬇️
    hostname: ${DD_HOST}
# ...
Example with DD_TAGS (click to expand)

The DD_TAGS environment variable is a special case, since the Collector expansion feature only supports scalar values.

If your configuration looks like this and is stored in a file config.yaml:

# ...
exporters:
  datadog:
    api:
      key: ${DD_API_KEY}
# ...

with an environment including DD_TAGS set to tagone:valone tagtwo:valtwo, you need to create a new environment variable, e.g COLLECTOR_EXTRA_CONFIG with value exporters::datadog::tags: ["tagone:valone", "tagtwo:valtwo"]

and pass the --config config.yaml --config env:COLLECTOR_EXTRA_CONFIG flags to your Collector binary. Configuration from the config.yaml file and the COLLECTOR_EXTRA_CONFIG environment variable will be merged when starting the Collector.

When will it change?

To be filled when this happens

Change description Version of deprecation Version of removal
Removal of automatic env variable detection v0.47.0 v0.56.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter/datadog Datadog components
Projects
None yet
1 participant