-1

I have created a simple, dummy OpenTelemetry Java Agent extension. It contains only one class and it looks like this:

import com.google.auto.service.AutoService;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider;

@AutoService(AutoConfigurationCustomizerProvider.class)
public class DummyAutoConfigurationCustomizerProvider implements AutoConfigurationCustomizerProvider {

    static {
        System.out.println("initialized DummyAutoConfigurationCustomizerProvider");
    }

    @Override
    public void customize(AutoConfigurationCustomizer autoConfigurationCustomizer) {
        System.out.println("customizing DummyAutoConfigurationCustomizerProvider");
    }
}

I have created a shaded JAR of this extension.

I have then run my application with the following Java options:

-javaagent:/opentelemetry-javaagent.jar -Dotel.javaagent.extensions=/lib-all.jar

However, I don't see any sign that my extension is loaded. The only log statement I get is this:

[otel.javaagent 2024-07-30 16:04:35:751 +0200] [main] INFO io.opentelemetry.javaagent.tooling.VersionLogger - opentelemetry-javaagent - version: 2.5.0

What am I missing? Why is my OpenTelemetry Java Agent not loaded?

1 Answer 1

1

The @com.google.auto.service.AutoService annotation requires an annotation processor.

I have removed the @com.google.auto.service.AutoService annotation.

Then I created the file META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider containing the content following content:

DummyAutoConfigurationCustomizerProvider

Now it works.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.