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

Use SDK Autoconfigure module #2077

Merged
merged 6 commits into from
Jan 20, 2021
Merged

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Jan 19, 2021

I realized that right now there's no way to configure ID generator with agent 0.14.0 - we relied on OpenTelemetry SPI for that, but don't use SPI anymore, instead using the OpenTelemetrySdkBuilder. So I think I'm going to need to release a patch version with this change. And presumably more patches as we work out any more kinks introduced which there must be :)

javaagent-tooling/javaagent-tooling.gradle Show resolved Hide resolved
log.warn("No valid exporter found. Tracing will run but spans are dropped");
return;
}
ExporterClassLoader exporterLoader =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to add an exporter SPI to SDK since it seems to make sense. But I wonder if it would be possible to use from agent given we load external JARs into separate classloader like this. Any idea?

Copy link
Member

Choose a reason for hiding this comment

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

ya, not sure how to make it play nice with the autoconfigure env vars

OpenTelemetrySdk sdk = OpenTelemetrySdkAutoConfiguration.initialize();
// TODO(anuraaga): Remove this workdaround after autoconfiguration is fixed to actually
// register the global.
GlobalOpenTelemetry.set(sdk);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops

@iNikem
Copy link
Contributor

iNikem commented Jan 19, 2021

@anuraaga Can we please not hurry with merging this PR? I want to get up to speed with new SDK configuration story in order to better understand this PR. But don't know how much time will it take. And I am VERY interested in this topic :)

@anuraaga
Copy link
Contributor Author

@iNikem Hopefully we can merge this week? :)

javaagent-tooling/javaagent-tooling.gradle Show resolved Hide resolved
implementation deps.opentelemetrySdkMetrics
implementation deps.opentelemetryKotlin
implementation deps.opentelemetryTraceProps
implementation(deps.opentelemetryResources) {
// exclude sdk-common to avoid bumping guava version
exclude group: 'io.opentelemetry', module: 'opentelemetry-sdk-common'
}
implementation deps.opentelemetryZipkin
Copy link
Contributor

Choose a reason for hiding this comment

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

Move somewhere closer to all other exporters? Or sort alphabetically?

log.warn("Filename could not be parsed: " + exporterJar + ". Exporter is not installed");
log.warn("No valid exporter found. Tracing will run but spans are dropped");
return;
// OpenTelemetrySdkAutoConfiguration currently only supports configuration from environment. We
Copy link
Contributor

Choose a reason for hiding this comment

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

But io/opentelemetry/sdk/autoconfigure/ConfigProperties.java:24 does read from system properties?

And I still don't quite understand what does this method do :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By environment, I meant both env vars and system properties here.

This method is to forward properties to the autoconfiguration for agent's unique sources, file and PropertySource. We may or may not want to move the handling of these to autoconfigure, or do something different but this is to play with a first iteration and works ok I think.

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.

This is really nice 👍

log.warn("No valid exporter found. Tracing will run but spans are dropped");
return;
}
ExporterClassLoader exporterLoader =
Copy link
Member

Choose a reason for hiding this comment

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

ya, not sure how to make it play nice with the autoconfigure env vars

…ootWithSamplingSmokeTest.groovy

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
@jkwatson
Copy link
Contributor

I'm confused about the idgenerator bit. Can't you configure one via the SdkTracerProviderBuilder via the SdkTracerProviderConfigurer SPI? It seems like a rare enough thing to have to provide a custom id generator, that a custom SPI implementation seems like it would be an ok approach to me.

@anuraaga
Copy link
Contributor Author

@jkwatson That works after this PR, not before where we aren't using the autoconfigure module :P

@@ -102,6 +102,7 @@ abstract class SmokeTest extends Specification {
.withEnv("OTEL_BSP_MAX_EXPORT_BATCH_SIZE", "1")
.withEnv("OTEL_BSP_SCHEDULE_DELAY_MILLIS", "10")
.withEnv("OTEL_EXPORTER_OTLP_ENDPOINT", "collector:55680")
.withEnv("OTEL_EXPORTER_OTLP_INSECURE", "true")
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why this is now required. Are we defaulting to requiring TLS somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@breedx-splk and I ran into this today while setting doing some benchmarking work around some possible tweaks to the jdbc instrumentation. Definitely confused us for a while!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jkwatson Oh - yeah I guess it affects HEAD agent right now, but won't affect the released 0.15.0 since we'll migrate to the scheme by then.

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.

None yet

4 participants