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 jaeger remote sampler #4898

Closed
pavolloffay opened this issue Dec 14, 2021 · 6 comments · Fixed by #5346
Closed

Add jaeger remote sampler #4898

pavolloffay opened this issue Dec 14, 2021 · 6 comments · Fixed by #5346
Labels
enhancement New feature or request
Milestone

Comments

@pavolloffay
Copy link
Member

Is your feature request related to a problem? Please describe.

I want to use Jaeger remote sampler https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/jaeger-remote-sampler with Javaagent

Describe the solution you'd like

Make https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/jaeger-remote-sampler available in the javaagent distribution.

Describe alternatives you've considered

Build a custom javaagent.

Additional context

Jaeger remote sampler in the spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md

@pavolloffay pavolloffay added the enhancement New feature or request label Dec 14, 2021
@mateuszrzeszutek
Copy link
Member

You don't really need to build a custom javaagent, you can use the sampler as an extension.

@trask
Copy link
Member

trask commented Dec 14, 2021

You don't really need to build a custom javaagent, you can use the sampler as an extension.

👍

it would still be nice to add this to the javaagent distribution since there's already spec support for OTEL_TRACES_SAMPLER=jaeger_remote

@pavolloffay is this the same as #1953?

@pavolloffay
Copy link
Member Author

It seems related to #1953. I would say the #1953 is not correctly defined as the sampling strategies are not pulled by the exporter.

@pavolloffay
Copy link
Member Author

I have started looking at this.

@anuraaga is my understanding correct that the Jaeger remote sampler will require some work to make this work in the auto-instrumentation? The root cause is open-telemetry/opentelemetry-specification#1996?

Or could we use one of grpc-okhttp, grpc-netty, or grpc-netty-shaded for the remote sampler?

I am getting the following error.

[otel.javaagent 2021-12-15 16:09:07:268 +0100] [main] INFO io.opentelemetry.javaagent.tooling.VersionLogger - opentelemetry-javaagent - version: 1.10.0-SNAPSHOT
ERROR io.opentelemetry.javaagent.OpenTelemetryAgent
io.grpc.ManagedChannelProvider$ProviderNotFoundException: No functional channel service provider found. Try adding a dependency on the grpc-okhttp, grpc-netty, or grpc-netty-shaded artifact
	at io.grpc.ManagedChannelProvider.provider(ManagedChannelProvider.java:43)
	at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:76)
	at io.opentelemetry.exporter.otlp.internal.grpc.DefaultGrpcExporterBuilder.build(DefaultGrpcExporterBuilder.java:131)
	at io.opentelemetry.exporter.jaeger.JaegerGrpcSpanExporterBuilder.build(JaegerGrpcSpanExporterBuilder.java:92)
	at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureJaeger(SpanExporterConfiguration.java:186)
	at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureExporter(SpanExporterConfiguration.java:104)
	at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.lambda$configureSpanExporters$1(SpanExporterConfiguration.java:94)
	at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:178)
	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureSpanExporters(SpanExporterConfiguration.java:89)
	at io.opentelemetry.sdk.autoconfigure.TracerProviderConfiguration.configureTracerProvider(TracerProviderConfiguration.java:61)
	at io.opentelemetry.sdk.autoconfigure.OpenTelemetrySdkAutoConfiguration.newOpenTelemetrySdk(OpenTelemetrySdkAutoConfiguration.java:104)
	at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.build(AutoConfiguredOpenTelemetrySdkBuilder.java:177)
	at io.opentelemetry.javaagent.tooling.OpenTelemetryInstaller.installOpenTelemetrySdk(OpenTelemetryInstaller.java:42)
	at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:125)
	at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:96)
	at io.opentelemetry.javaagent.tooling.AgentStarterImpl.start(AgentStarterImpl.java:65)
	at io.opentelemetry.javaagent.bootstrap.AgentInitializer.initialize(AgentInitializer.java:37)
	at io.opentelemetry.javaagent.OpenTelemetryAgent.startAgent(OpenTelemetryAgent.java:55)
	at io.opentelemetry.javaagent.OpenTelemetryAgent.premain(OpenTelemetryAgent.java:44)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
^C% 

@trask
Copy link
Member

trask commented Dec 15, 2021

oh ya, this is because we don't use grpc or protobuf dependencies anymore. all the standard otel exporters (including the jaeger exporter) now hand marshal the protobuf data and send it directly using okhttp. check out for example open-telemetry/opentelemetry-java#3800.

not including grpc/netty/protobuf dependencies saved us a few MB in the javaagent jar, so I don't think we would want to bring those dependencies back just to support jaeger remote sampler.

probably will need to update the jaeger remote sampler to use similar "grpc lite" mechanism first

@pavolloffay
Copy link
Member Author

thanks Trask, I will take a look at it in the otel-java repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants