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 env setting #9016

Closed
Tracked by #8372
mx-psi opened this issue Apr 4, 2022 · 2 comments · Fixed by #12110
Closed
Tracked by #8372

[exporter/datadog] Remove env setting #9016

mx-psi opened this issue Apr 4, 2022 · 2 comments · Fixed by #12110
Labels
exporter/datadog Datadog components

Comments

@mx-psi
Copy link
Member

mx-psi commented Apr 4, 2022

What will change?

The env setting from the Datadog exporter will be removed in favor of using the deployment.environment semantic convention.

Who is affected?

You are affected if you use the env setting from the exporter. If you are affected, a warning will be logged stating that you are using it, together with a link to this issue.

Example warning:

Deprecated: "env" has been deprecated and will be removed in v0.52.0. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/9016

What should I do if I am affected?

Remove any references to env from your configuration and set the deployment.environment semantic convention on your SDK or using the resource processor instead.

Example using the Go SDK for traces (click to expand)

If using:

# ...
exporters:
  datadog:
    api:
      key: ${DD_API_KEY}
    env: test-environment
# ...

You can remove the service setting and set this as a resource on the Go SDK. This is similar to the way one sets service.name, shown on the official example:

First, create a new resource with the environment name:

ctx := context.Background()
res, err := resource.New(ctx,
		resource.WithAttributes(
			// the service name used to display traces in backends
			semconv.DeploymentEnvironmentKey.String("test-environment"),
		),
	)

Then, pass it to your trace provider builder as an option:

tracerProvider := sdktrace.NewTracerProvider(
                // other options may go here ...
		sdktrace.WithResource(res),	
     )

All language SDKs support setting semantic conventions; if you need help please reach out on the language SDK repo or comment here

Example using the resource processor (click to expand)

If using:

# ...
exporters:
  datadog:
    api:
      key: ${DD_API_KEY}
    env:  test-environment
# ...

You can replace it by using a resource processor, which will override any existing service.name attribute:

processors:
  resource:
    attributes:
       - key: deployment.environment
          value: "test-environment"
          action: upsert

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

Lastly, you need to add the resource processor to all your pipelines.

If you also want to keep env as a host tag, you will need to add it to the tags list.

When will it change?

To be filled when this happens

Change description Version of deprecation Version of removal
Removal of env v0.49.0 v0.56.0
@AndersClausen
Copy link

You missed out on 'attributes' in the processors/resource example above

@mx-psi
Copy link
Member Author

mx-psi commented Sep 5, 2022

Should be fixed now, thanks @AndersClausen :)

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
Development

Successfully merging a pull request may close this issue.

2 participants