question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: OpenTelemetry tracing fails to start with NoSuchMethodError

See original GitHub issue

What happened?

I followed the instructions from java -jar selenium-server-4.1.2.jar info tracing to start selenium with OpenTelemetry and Jaeger but I got an exception at startup.

About Tracing
=============

Selenium Grid ships with support for distributed tracing, backed by the OpenTelemetry
APIs. This allows admins and devops engineers to trace the flow of control
through the Grid for each and every command.

To enable this support, you must first provide a "Tracer" implementation that
should be used. We use OpenTelemtry's own mechanisms for selecting the implementations,
so if your chosen tracing library supports this you should be good to go.
If you are using the standalone selenium jar, updating the classpath to contain
your tracer can be done using the `--ext` flag to selenium.

As a worked example, using Jaeger as the tracing library and running on macOS:


  java -Dotel.traces.exporter=jaeger \
       -Dotel.exporter.jaeger.endpoint=http://localhost:14250 \
       -Dotel.resource.attributes=service.name=selenium-standalone \
       -jar selenium.jar \
       --ext $(coursier fetch -p \
          io.opentelemetry:opentelemetry-exporter-jaeger:1.9.1 \
          io.grpc:grpc-netty:1.41.0) \
       standalone


This example uses a tool called "coursier" to generate a full classpath, but
you can also write this manually. When started this way, the selenium server
will inform you that it has found a tracer on stdout.


Maybe some dependency is missing?

How can we reproduce the issue?

java -Dotel.traces.exporter=jaeger -Dotel.exporter.jaeger.endpoint=http://localhost:14250 -Dotel.resource.attributes=service.name=selenium-standalone -jar selenium-server-4.1.2.jar --ext $(coursier fetch -p io.opentelemetry:opentelemetry-exporter-jaeger:1.9.1 io.grpc:grpc-netty:1.41.0) standalone

Relevant log output

11:35:19.866 INFO [LogManager$RootLogger.log] - Using the system default encoding
11:35:19.884 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.openqa.selenium.grid.Bootstrap.runMain(Bootstrap.java:77)
        at org.openqa.selenium.grid.Bootstrap.main(Bootstrap.java:70)
Caused by: java.lang.NoSuchMethodError: io.opentelemetry.api.metrics.LongCounter.bind(Lio/opentelemetry/api/common/Attributes;)Lio/opentelemetry/api/metrics/BoundLongCounter;
        at io.opentelemetry.exporter.otlp.internal.grpc.OkHttpGrpcExporter.<init>(OkHttpGrpcExporter.java:87)
        at io.opentelemetry.exporter.otlp.internal.grpc.OkHttpGrpcExporterBuilder.build(OkHttpGrpcExporterBuilder.java:142)
        at io.opentelemetry.exporter.jaeger.JaegerGrpcSpanExporterBuilder.build(JaegerGrpcSpanExporterBuilder.java:92)
        at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureJaeger(SpanExporterConfiguration.java:179)
        at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureExporter(SpanExporterConfiguration.java:94)
        at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.lambda$configureSpanExporters$0(SpanExporterConfiguration.java:80)
        at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1321)
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
        at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureSpanExporters(SpanExporterConfiguration.java:75)
        at io.opentelemetry.sdk.autoconfigure.TracerProviderConfiguration.configureTracerProvider(TracerProviderConfiguration.java:63)
        at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.build(AutoConfiguredOpenTelemetrySdkBuilder.java:192)
        at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk.initialize(AutoConfiguredOpenTelemetrySdk.java:29)
        at org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer.createTracer(OpenTelemetryTracer.java:77)
        at org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer.getInstance(OpenTelemetryTracer.java:59)
        at org.openqa.selenium.grid.log.LoggingOptions.getTracer(LoggingOptions.java:94)
        at org.openqa.selenium.grid.commands.Standalone.createHandlers(Standalone.java:117)
        at org.openqa.selenium.grid.TemplateGridServerCommand.asServer(TemplateGridServerCommand.java:41)
        at org.openqa.selenium.grid.commands.Standalone.execute(Standalone.java:214)
        at org.openqa.selenium.grid.TemplateGridCommand.lambda$configure$4(TemplateGridCommand.java:129)
        at org.openqa.selenium.grid.Main.launch(Main.java:83)
        at org.openqa.selenium.grid.Main.go(Main.java:57)
        at org.openqa.selenium.grid.Main.main(Main.java:42)
        ... 6 more

Operating System

Ubuntu 16.04.7 LTS

Selenium version

Java 4.1.2

What are the browser(s) and version(s) where you see this issue?

N/A

What are the browser driver(s) and version(s) where you see this issue?

N/A

Are you using Selenium Grid?

4.1.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
pujaganicommented, Mar 9, 2022

The issue is not related to OpenTelemetry. Selenium Grid discovers drivers and adds them as nodes based on the drivers it detects in your system PATH. Ensure the drivers are on the PATH https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/#2-the-path-environment-variable.

0reactions
github-actions[bot]commented, Apr 9, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

open-telemetry/opentelemetry-java - Gitter
Hello, I have a question, does mTLS is supported by OTLP Exporter? TLS works fine, but I can't export spans using mTLS ....
Read more >
Error handling in OpenTelemetry
The API or SDK MAY fail fast and cause the application to fail on initialization, e.g. because of a bad user config or...
Read more >
OpenTelemetry autoinstrumentation. Error with export spans ...
I have a simple spring boot app and am trying to learn how to export spans with opentelemetry-javaagent via OpenTelemetry ...
Read more >
[Java] New Relic Java Agent 5.14.0 java.lang ...
Typically a NoSuchMethodError is a clue there is a mismatch in the code and expected methods are not found. Is it a fair...
Read more >
OpenTelemetry for Java - Honeycomb Documentation
OpenTelemetry makes it easy to instrument your code with support for ... If a This trace has multiple spans sharing the same non-null...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found