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

[maven-extension] Use the Otel SDK Auto Configuration Extension #112

Merged
merged 3 commits into from
Oct 18, 2021

Conversation

cyrille-leclerc
Copy link
Member

@cyrille-leclerc cyrille-leclerc commented Oct 12, 2021

Description:

Use the Otel SDK Auto Configuration Extension instead of reinventing all the configuration boilerplate.

ℹ️ Note that this PR doesn't extend the supported exporter (e.g. doesn't add support for OTLP HTTP...), we only have OTLP GRPC for the moment, it should be easy to extend as all the logic is provided by the Otel SDK Auto Configuration Extension now.

Existing Issue(s):

Testing:

We don't have auto integration tests yet so tests have to be done manually.

export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
mvn verify
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_RESOURCE_ATTRIBUTES="foo=bar"
mvn verify
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_RESOURCE_ATTRIBUTES="service.name=MyMavenService"
mvn verify

Documentation:

No documentation added because the user experience didn't change.

Outstanding items:

Both items below are tracked in the code as TODO.

  • Create an enhancement request on the Otel SDK Auto Configuration Extension to not register the shut down hook during initialisation if the system that embeds the Otel SDK manages the lifecycle. It doesn't cause problems with the Maven Plexus lifecycle but there is a risk.
  • Explore how to use io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties to pass configuration parameters instead of shoving them in system properties.

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.

There are improvements we can make in autoconfigure to help with the properties stuff indeed


final class OtelUtils {

public static String getComaSeparatedString(Map<String, String> keyValuePairs) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static String getComaSeparatedString(Map<String, String> keyValuePairs) {
public static String getCommaSeparatedString(Map<String, String> keyValuePairs) {

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@cyrille-leclerc
Copy link
Member Author

There are improvements we can make in autoconfigure to help with the properties stuff indeed

Thanks @anuraaga , I am learning the SDK Auto Configure Extension APIs and already have done improvements adopting it on the Jenkins OpenTelemetry Plugin (I use io.opentelemetry.sdk.autoconfigure.spi.ConfigPropertiesinstead of showing my overwrites as system properties...). See jenkinsci/opentelemetry-plugin#185

I see this as an iterative journey with enhancement proposals on the SDK Auto Configure Extension APIs and refactoring of the usage of the extension in the Maven and Jenkins integrations.
Would that make sense to you?

@anuraaga
Copy link
Contributor

Yeah ready to merge this after fixing the build in #114

@anuraaga anuraaga merged commit 48ec2e1 into open-telemetry:main Oct 18, 2021
@cyrille-leclerc cyrille-leclerc deleted the use-auto-configure branch October 18, 2021 15:55
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