Closed geraldus closed 1 week ago
I think the SDK honours OTEL_RESOURCE_ATTRIBUTES
, but I'm not sure if there's a way to set them programmatically, currently.
There are two ways to provide resource attributes directly:
Resource
in code to getTracerProviderInitializationOptions'
during initialization.OTEL_RESOURCE_ATTRIBUTES
environment variable.These are considered user-provided resource attributes, and will be merged with any attributes gathered from built-in resource detectors or SDK defaults. This sounds like it fits your use case, and has been sufficient in my own experience. More sophisticated resource configuration is likely possible with custom resource detectors.
Note: The user-provided resource attributes should be prioritized over the built-in resource detectors, but due Issue #111 the merge priority was reversed. This is likely fixed by PR #156. See the tests added in that PR for some examples on how to implement these approaches.
Thanks, I've already found this out from sources, setting OTEL_RESOURCE_ATTRIBUTES works as expected. Closing this for now.
Resolved
Hello! I've noticed that adding span attributes (also known as tags) seems straightforward, but I'm having difficulty understanding if there's an approach to configure resource attributes (also known as process tags). In my situation, they are static, determined at startup, and remain consistent across all spans (such as environment, application name, version, etc.).