grafana / pyroscope-java

pyroscope java integration
Apache License 2.0
72 stars 31 forks source link

Error initializing the profiler #153

Open kgoedert opened 1 month ago

kgoedert commented 1 month ago

I am trying to integrate opentelemetry and pyroscope in my application. Here is my Dockerfile:

FROM openjdk:17-slim-bullseye

ENV OTEL_SERVICE_NAME=cart-api
ENV OTEL_TRACES_EXPORTER=zipkin,otlp
ENV OTEL_METRICS_EXPORTER=prometheus
ENV OTEL_LOGS_EXPORTER=otlp
ENV OTEL_EXPORTER_ZIPKIN_ENDPOINT=http://zipkin:9411/api/v2/spans
ENV OTEL_SERVICE_NAME=cartorio-api
ENV OTEL_EXPORTER_PROMETHEUS_PORT=9464
ENV OTEL_EXPORTER_PROMETHEUS_HOST=0.0.0.0
ENV OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://otel-collector:4317
ENV OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=grpc
ENV OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://tempo:4317
ENV OTEL_EXPORTER_PROMETHEUS_PORT=9464
ENV OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc

ENV PYROSCOPE_APPLICATION_NAME=cartorio-api
ENV PYROSCOPE_FORMAT=jfr
ENV PYROSCOPE_PROFILING_INTERVAL=10ms
ENV PYROSCOPE_PROFILER_EVENT=itimer
ENV PYROSCOPE_PROFILER_LOCK=10ms
ENV PYROSCOPE_PROFILER_ALLOC=512k
ENV PYROSCOPE_UPLOAD_INTERVAL=15s
ENV PYROSCOPE_LOG_LEVEL=debug
ENV PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040

ENV OTEL_PYROSCOPE_ADD_PROFILE_URL=false
ENV OTEL_PYROSCOPE_ADD_PROFILE_BASELINE_URL=false
ENV OTEL_PYROSCOPE_START_PROFILING=true
ENV OTEL_JAVAAGENT_EXTENSIONS=/pyroscope-otel.jar

ADD https://repo1.maven.org/maven2/io/pyroscope/otel/0.10.1.11/otel-0.10.1.11.jar /pyroscope-otel.jar
ADD https://github.com/grafana/pyroscope-java/releases/download/v0.12.2/pyroscope.jar /pyroscope.jar
ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.17.0/opentelemetry-javaagent.jar /opentelemetry-javaagent.jar

ADD cart-api-0.0.1-SNAPSHOT.jar /app.jar

EXPOSE 8080
EXPOSE 8282

CMD ["java","-javaagent:opentelemetry-javaagent.jar", "-javaagent:pyroscope.jar","-Dspring.profiles.active=hml","-jar" ,"/app.jar"]

When the application starts I get this error in the logs:

[ERROR] Error starting profiler java.lang.IllegalStateException: java.lang.IllegalStateException: Could not set dlopen hook. Unsupported JVM?

I can't see any CPU information related to my application on pyroscope. I also tried different versions on the jvm and of pyroscope and open telemetry agent.

Can anyone help?