Search code examples
javajavaagentsopen-telemetry

Java agent OTel not working with New Relic


I have a Java application running with an OTel agent to collect telemetries and send them to the New Relic platform.

Configuration of OTel Java agent:

-javaagent:./agents/opentelemetry-javaagent-all.jar
-Dotel.traces.exporter=otlp
-Dotel.resource.attributes=service.name=my-application
-Dotel.exporter.otlp.endpoint=https://otlp.nr-data.net:4317
-Dotel.exporter.otlp.headers=api-key=${NEW_RELIC_LICENSE_KEY}

When this app is starting an error occurs:

Caused by: java.lang.IllegalArgumentException: cannot find a NameResolver for https://otlp.nr-data.net:4317

How to resolve this problem?


Solution

  • The problem has been solved for me when adjusting Dockerfile forcing the download of OTel java agent on the image build process.

    From:

    COPY ./agents/opentelemetry-javaagent-all.jar .
    

    To:

    ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.12.1/opentelemetry-javaagent.jar .