-
Notifications
You must be signed in to change notification settings - Fork 855
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
Add EnvironmentResourceProvider #8604
Add EnvironmentResourceProvider #8604
Conversation
I thought about moving this to opentelemetry-java/sdk/common, but doing so creates a circular dependency since this code depends on |
Seems like a totally reasonable approach to me! Only concern is the possibility of breaking existing users who might be expecting this one, but not have pulled in any other jars. |
That's true.. a user that consumes autoconfigure direclty, without the agent, will need to add a dependency on this artifact to keep the same behavior. I think that's acceptable. Can emphasize it in release notes, and mention this instrumentation resource module in the opentelemetry.io docs to really drive home the importance. |
...ry/src/main/java/io/opentelemetry/instrumentation/resources/EnvironmentResourceProvider.java
Show resolved
Hide resolved
...es/library/src/main/java/io/opentelemetry/instrumentation/resources/EnvironmentResource.java
Outdated
Show resolved
Hide resolved
Lets hold off merging this and decide if we prefer the approach outlined in opentelemetry-java#5500 instad. |
Closing in favor of opentelemetry-java#5554. |
An option that may nicely cleanup the problem discussed here, where the autoconfigured resource from the environment is only accessible through via a roundabout API that instantiates an SDK.
This moves the environment resource logic to the
io.opentelemetry.instrumentation:opentelemetry-resources
, along side other resource providers. AResourceProvider
is provided, but you can also programatically access the environment resource via:EnvironmentResource.get()
- access singleton resource which parses environment variables and system propertiesEnvironmentResource.create(ConfigProperties)
- create an environment resource by parsing properties fromConfigProperties
. Allows you to bring your own set of configuration overrides.WDYT?
cc @jkwatson