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

Unrecognized value for otel.traces.exporter: google_cloud_trace #303

Closed
induslevel opened this issue Mar 8, 2024 · 3 comments
Closed

Unrecognized value for otel.traces.exporter: google_cloud_trace #303

induslevel opened this issue Mar 8, 2024 · 3 comments
Assignees

Comments

@induslevel
Copy link

I am following the public documentation to setup auto instrumentation of a test application.

I am getting Error
Unrecognized value for otel.traces.exporter: google_cloud_trace

Here are the arguments that I am using for running the jar file

java -javaagent:opentelemetry-2.1.0.jar      
-Dotel.traces.exporter=google_cloud_trace \
-Dotel.service.name=gcrs-publisher-service  \
-Dhelloworld.port=8000 \
-Dotel.metrics.exporter=none \
-Dotel.javaagent.debug=false \      
-jar HelloWorld.jar

I am getting the following error

OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[otel.javaagent 2024-03-08 08:44:44:604 +0000] [main] INFO io.opentelemetry.javaagent.tooling.VersionLogger - opentelemetry-javaagent - version: 2.1.0
[otel.javaagent 2024-03-08 08:44:44:807 +0000] [main] INFO io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder - Error encountered during autoconfiguration. Closing partially configured components.
OpenTelemetry Javaagent failed to start

io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException: Unrecognized value for otel.traces.exporter: google_cloud_trace

        at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureExporter(SpanExporterConfiguration.java:102)
        at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureSpanExporters(SpanExporterConfiguration.java:67)
        at io.opentelemetry.sdk.autoconfigure.TracerProviderConfiguration.configureTracerProvider(TracerProviderConfiguration.java:55)
        at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.build(AutoConfiguredOpenTelemetrySdkBuilder.java:416)
        at io.opentelemetry.javaagent.tooling.OpenTelemetryInstaller.installOpenTelemetrySdk(OpenTelemetryInstaller.java:29)
        at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:123)
        at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:103)
        at io.opentelemetry.javaagent.tooling.AgentStarterImpl.start(AgentStarterImpl.java:99)
        at io.opentelemetry.javaagent.bootstrap.AgentInitializer$1.run(AgentInitializer.java:53)
        at io.opentelemetry.javaagent.bootstrap.AgentInitializer$1.run(AgentInitializer.java:47)
        at io.opentelemetry.javaagent.bootstrap.AgentInitializer.execute(AgentInitializer.java:64)
        at io.opentelemetry.javaagent.bootstrap.AgentInitializer.initialize(AgentInitializer.java:46)
        at io.opentelemetry.javaagent.OpenTelemetryAgent.startAgent(OpenTelemetryAgent.java:57)
        at io.opentelemetry.javaagent.OpenTelemetryAgent.premain(OpenTelemetryAgent.java:45)
        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)`

Questions:
Q1: Is there any step missing in documentation to configure the application to send traces to Cloud trace?

Q2: The documentation mentioned "opentelemetry-javaagent--all.jar" whereas official link [8] downloads the agent with name "opentelemetry-javaagent.jar" (i.e. without -all)
Is this gap in documentation or is there any other link/repo from where we can download this agent?

Q3:
What is the purpose of following argument in the documentation

-Dotel.javaagent.extensions=path/to/opentelemetry-operations-java-auto-<version>.jar
@psx95 psx95 self-assigned this Mar 8, 2024
@psx95
Copy link
Contributor

psx95 commented Mar 8, 2024

Hi @induslevel,

Thank you for providing the configuration details along with the stacktrace.

To answer your questions,

  1. OpenTelemetry Java Agent by default only recognizes a few values for -Dotel.traces.exporter flag. The recognized exporters are mentioned on the OpenTelemetry documentation. As you can see, google_cloud_trace is not one of the known exporters. To export your traces using the google_cloud_trace exporter, you need to first add it as an extension to the agent. This is explained in the Autoinstrumentation setup instructions. (This step is further expanded upon in the answer to your third question).

  2. At the time of writing the documentation for our exporters, the OpenTelemetry Java agent was published with -all suffix. For instance, look at the assets published along with the release of v1.5.0 of the opentelemetry-java-instrumentation. We will update the documentation to reflect the change to the name of published agent artifact.

  3. This argument configures the OpenTelemetry Java Agent to use the Google Cloud Auto-exporter as a Java agent extension. Extensions allow us to modify or override the agent's capability in some fashion. In short, adding Google Cloud Auto-Exporter jar as an extension to the Java Agent provides the agent with the capability to export to Google Cloud.

    • (Adding this configuration option will allow you to specify google_cloud_trace as a recognized value in -Dotel.traces.exporter)

For your arguments being passed to the agent, could you try adding -Dotel.javaagent.extensions=<path to the auto-exporter shaded jar> ?

The instructions for this are mentioned in the README for auto exporter.

@aabmass
Copy link
Contributor

aabmass commented Mar 11, 2024

@induslevel is this working for you now?

@induslevel
Copy link
Author

Yes. I was able to see exported trace.

java -javaagent:opentelemetry-2.1.0.jar \
     -Dotel.javaagent.extensions=exporter-auto-0.26.0-alpha-shaded.jar \
     -Dotel.traces.exporter=google_cloud_trace \
     -Dotel.metrics.exporter=google_cloud_monitoring \
     -DGOOGLE_CLOUD_PROJECT=XXXXXXXX \
     -DGOOGLE_APPLICATION_CREDENTIALS=/root/.config/gcloud/application_default_credentials.json \
     -Dotel.javaagent.debug=true \
     -Dhelloworld.port=8000 \
     -jar HelloWorld.jar

You can mark this issue as resolved. Thank you so much for your support.

@psx95 psx95 closed this as completed Mar 12, 2024
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

No branches or pull requests

3 participants