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

Add EnvironmentResourceProvider #8604

Conversation

jack-berg
Copy link
Member

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. A ResourceProvider is provided, but you can also programatically access the environment resource via:

  • EnvironmentResource.get() - access singleton resource which parses environment variables and system properties
  • EnvironmentResource.create(ConfigProperties) - create an environment resource by parsing properties from ConfigProperties. Allows you to bring your own set of configuration overrides.

WDYT?

cc @jkwatson

@jack-berg jack-berg requested a review from a team May 30, 2023 16:55
@github-actions github-actions bot requested a review from theletterf May 30, 2023 16:56
@jack-berg
Copy link
Member Author

I thought about moving this to opentelemetry-java/sdk/common, but doing so creates a circular dependency since this code depends on ConfigProperties (:sdk:common -> :sdk-extensions:autoconfigure-spi -> :sdk:common).

@jkwatson
Copy link
Contributor

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.

@jack-berg
Copy link
Member Author

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.

@jack-berg
Copy link
Member Author

Lets hold off merging this and decide if we prefer the approach outlined in opentelemetry-java#5500 instad.

@jack-berg
Copy link
Member Author

Closing in favor of opentelemetry-java#5554.

@jack-berg jack-berg closed this Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants