It works fine when I run Java 11:
java -javaagent:./otel/opentelemetry-javaagent.jar
-DOTEL_EXPORTER_OTLP_COMPRESSION=gzip
-DOTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT=4095
-DOTEL_JAVA_DISABLED_RESOURCE_PROVIDERS=io.opentelemetry.sdk.extension.resources.ProcessResourceProvider
-DOTEL_EXPERIMENTAL_EXPORTER_OTLP_RETRY_ENABLED=true
-DOTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=DELTA
-Dotel.traces.exporter=otlp
-Dotel.metrics.exporter=otlp
-Dotel.logs.exporter=otlp
-Dotel.exporter.otlp.endpoint=https://otlp.nr-data.net:4317
-Dotel.resource.attributes=service.name=app-service
-Dotel.exporter.otlp.headers=api-key=<api-key>
-Dotel.javaagent.debug=false -jar ./target/app-service-0.0.1-SNAPSHOT.jar
But when I run in Java 8, it fails:
ENTRYPOINT ["java",
"-Dotel.traces.exporter=otlp",
"-Dotel.metrics.exporter=otlp",
"-Dotel.logs.exporter=otlp",
"-Dotel.exporter.otlp.endpoint=https://otlp.nr-data.net:4317",
"-DOTEL_EXPORTER_OTLP_COMPRESSION=gzip",
"-DOTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT=4095",
"-DOTEL_JAVA_DISABLED_RESOURCE_PROVIDERS=io.opentelemetry.sdk.extension.resources.ProcessResourceProvider",
"-DOTEL_EXPERIMENTAL_EXPORTER_OTLP_RETRY_ENABLED=true",
"-DOTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=DELTA",
"-Dotel.exporter.otlp.headers=api-key=<api-key>",
"-Dotel.resource.attributes=service.name=app-service",
"-Dotel.javaagent.debug=false",
"-javaagent:opentelemetry-javaagent.jar", "-jar", "app-service.jar"]
Getting the following error:
[otel.javaagent] [OkHttp https://otlp.nr-data.net:4317/...] WARN io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter - Failed to export logs. Server responded with HTTP status code 464.
Dockerfile:
FROM maven:3.8.1-jdk-8-slim AS build
WORKDIR /opt/app
COPY src src
COPY pom.xml .
RUN mvn -f pom.xml clean install
FROM openjdk:8-jdk-alpine
COPY --from=build /opt/app/target/app-service-*.jar app-service.jar
COPY ./otel/opentelemetry-javaagent.jar opentelemetry-javaagent.jar
EXPOSE 8080
ENTRYPOINT ["java", "-javaagent:opentelemetry-javaagent.jar", "-jar", "app-service.jar"]
I am using opentelemetry-javaagent – version: 1.12.0.
Any idea which version of new relic open telemetry agent works for Java 8?
2
Answers
Here is the solution for the issue reported: https://discuss.newrelic.com/t/java-464-error-with-new-relic-data-export-from-the-java-8-application-running-with-opentelemetry-agent/187361/3?u=valsaraj
464 indicates a problem with protocol mixing – HTTP vs GRPC. Use HTTP explicitly, because grpc exporter has this problem:
Maybe you have something (proxy, firewal, WAF, …) what is causing a problem with GRPC connection from the container.
See doc: https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md