open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.79k stars 782 forks source link

add debug log confirming what is loaded by OTEL_JAVAAGENT_EXTENSIONS #11616

Open vincent-fuchs opened 1 week ago

vincent-fuchs commented 1 week ago

Describe the bug

I have built a custom Sampler that I have placed in a jar. Following the docs, I am starting my application with OTEL_JAVAAGENT_EXTENSIONS env variable, pointing to the jar where my custom sampler and its provider are, but at startup, my sampler is not found, and I get very little information, even with debug enabled :

[otel.javaagent 2024-06-17 21:17:10:976 -0400] [main] INFO io.opentelemetry.javaagent.tooling.VersionLogger - opentelemetry-javaagent - version: 2.1.0 [otel.javaagent 2024-06-17 21:17:10:976 -0400] [main] DEBUG io.opentelemetry.javaagent.tooling.VersionLogger - Running on Java 17.0.8.1. JVM OpenJDK 64-Bit Server VM - Eclipse Adoptium - 17.0.8.1+1 [otel.javaagent 2024-06-17 21:17:10:976 -0400] [main] DEBUG io.opentelemetry.javaagent.tooling.AgentInstaller - io.opentelemetry.javaagent.tooling.AgentInstaller loaded on io.opentelemetry.javaagent.bootstrap.AgentClassLoader@73ad2d6 [otel.javaagent 2024-06-17 21:17:16:037 -0400] [main] DEBUG io.opentelemetry.sdk.internal.JavaVersionSpecific - Using the APIs optimized for: Java 9+ [otel.javaagent 2024-06-17 21:17:16:044 -0400] [main] INFO io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder - Error encountered during autoconfiguration. Closing partially configured components. [otel.javaagent 2024-06-17 21:17:16:044 -0400] [main] DEBUG io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder - Closing io.opentelemetry.sdk.metrics.SdkMeterProvider OpenTelemetry Javaagent failed to start io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException: Unrecognized value for otel.traces.sampler: mySampler at io.opentelemetry.sdk.autoconfigure.TracerProviderConfiguration.configureSampler(TracerProviderConfiguration.java:201) at io.opentelemetry.sdk.autoconfigure.TracerProviderConfiguration.configureTracerProvider(TracerProviderConfiguration.java:52)

Steps to reproduce

launch your application with OTEL_JAVAAGENT_EXTENSIONS env variable pointing to something that doesn't exist : you won't get any particular warning in the logs.

Expected behavior

It would be useful to get more infos in debug logs :

Actual behavior

no particular infos in debug logs, pertaining to whether the provided configuration is correct/useful or not.

Javaagent or library instrumentation version

2.1.0

Environment

JDK: Eclipse Adoptium - 17.0.8.1+1 OS: MacOs

Additional context

No response

trask commented 1 week ago

launch your application with OTEL_JAVAAGENT_EXTENSIONS env variable pointing to something that doesn't exist : you won't get any particular warning in the logs.

logging a warning in this case makes sense to me