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

Allow vendor distribution to provide default configuration #1243

Merged
merged 1 commit into from
Sep 29, 2020

Conversation

mateuszrzeszutek
Copy link
Member

@mateuszrzeszutek mateuszrzeszutek commented Sep 23, 2020

Resolves #1213

As an additional benefit, now all SDK ConfigBuilders can use properties from both SPI and the otel.trace.config file (which they did not use before).

Needs to be merged after #1254

@mateuszrzeszutek mateuszrzeszutek changed the title Allow vendor distribution to provide default configuration [WORK IN PROGRESS] Allow vendor distribution to provide default configuration Sep 23, 2020
@mateuszrzeszutek mateuszrzeszutek changed the title [WORK IN PROGRESS] Allow vendor distribution to provide default configuration Allow vendor distribution to provide default configuration Sep 23, 2020
@mateuszrzeszutek mateuszrzeszutek marked this pull request as ready for review September 23, 2020 14:39
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mateuszrzeszutek!

What do you think of turning Config into just a POJO (e.g. @AutoValue)? (e.g. still with static get() method to get the singleton instance)

And moving the construction of the Config object into javaagent-tooling?

Then wouldn't need to reference agent class loader from bootstrap class loader, which is where the complexity enters.

One other thought, it looks like the ExporterConfig arg to SpanExporterFactory.fromConfig(ExporterConfig) is basically unused, and if we replaced that with a Properties object (we can combine propertiesFromConfigFile and propertiesFromSpi before passing in), then the exporter modules wouldn't need to depend on instrumentation-api and javaagent-tooling which would be nice.

@iNikem
Copy link
Contributor

iNikem commented Sep 24, 2020

One other thought, it looks like the ExporterConfig arg to SpanExporterFactory.fromConfig(ExporterConfig) is basically unused, and if we replaced that with a Properties object (we can combine propertiesFromConfigFile and propertiesFromSpi before passing in), then the exporter modules wouldn't need to depend on instrumentation-api and javaagent-tooling which would be nice.

If we pass just Properties into SpanExporterFactory, then we have to normalise keys there, right?

@mateuszrzeszutek
Copy link
Member Author

mateuszrzeszutek commented Sep 24, 2020

What do you think of turning Config into just a POJO (e.g. @AutoValue)? (e.g. still with static get() method to get the singleton instance)
And moving the construction of the Config object into javaagent-tooling?

That's a great idea!

One other thought, it looks like the ExporterConfig arg to SpanExporterFactory.fromConfig(ExporterConfig) is basically unused, and if we replaced that with a Properties object (we can combine propertiesFromConfigFile and propertiesFromSpi before passing in), then the exporter modules wouldn't need to depend on instrumentation-api and javaagent-tooling which would be nice.

Hmm, one downside of this approach would be duplicating the configuration loading order in each exporter: merged-spi-and-file-props -> env variables -> system properties.
Alternatively we could probably convert env var names (as @iNikem mentioned) to system property names and merge them all together into a single Properties instance.

Anyway, that seems like a lot of changes -- do you think that we should do it in this PR?

@iNikem
Copy link
Contributor

iNikem commented Sep 24, 2020

A, io.opentelemetry.sdk.common.export.ConfigBuilder already does that... Yes, I think it is a very good idea, to move actual compilation of configuration from many difference sources into a separate class in tooling module and to expose simple Config/Properties to other components.

@iNikem
Copy link
Contributor

iNikem commented Sep 24, 2020

Hmm, one downside of this approach would be duplicating the configuration loading order in each exporter: merged-spi-and-file-props -> env variables -> system properties.
Alternatively we could probably convert env var names (as @iNikem mentioned) to system property names and merge them all together into a single Properties instance.

You read configuration once, normalize it (or more precise, you let ConfigBuilder do it for you) and then pass single instance of already normalised Properties to all other components.

@mateuszrzeszutek
Copy link
Member Author

Nice, reusing SDK ConfigBuilder for this is a neat idea.

@mateuszrzeszutek
Copy link
Member Author

I've pushed a PR that contains all those refactorings: #1254
I'll rebase this one with it.

@mateuszrzeszutek
Copy link
Member Author

Rebased after merging the refactoring PR.

@trask @iNikem I'm just letting you know that this one is ready for review.

Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

@trask trask merged commit 08f34d0 into open-telemetry:master Sep 29, 2020
@mateuszrzeszutek mateuszrzeszutek deleted the config-spi branch November 18, 2022 10:26
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.

Allow vendor distribution to provide default configuration
4 participants