I am trying to use continuous profiling in a spring boot application using grafana pyroscope. I would like to be able to collect memory and cpu data.
The application Dockerfile looks like this:
<code>FROM eclipse-temurin:21-jre
ENV PYROSCOPE_APPLICATION_NAME=simple.java.app
ENV PYROSCOPE_PROFILING_INTERVAL=10ms
ENV PYROSCOPE_PROFILER_EVENT=cpu
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
ADD https://github.com/grafana/pyroscope-java/releases/download/v0.13.1/pyroscope.jar /pyroscope.jar
ADD cart-api-0.0.2-SNAPSHOT.jar /app.jar
EXPOSE 8080
EXPOSE 8282
CMD ["java", "-XX:-Inline", "-javaagent:pyroscope.jar", "-jar", "/app.jar"]
</code>
<code>FROM eclipse-temurin:21-jre
ENV PYROSCOPE_APPLICATION_NAME=simple.java.app
ENV PYROSCOPE_PROFILING_INTERVAL=10ms
ENV PYROSCOPE_PROFILER_EVENT=cpu
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
ADD https://github.com/grafana/pyroscope-java/releases/download/v0.13.1/pyroscope.jar /pyroscope.jar
ADD cart-api-0.0.2-SNAPSHOT.jar /app.jar
EXPOSE 8080
EXPOSE 8282
CMD ["java", "-XX:-Inline", "-javaagent:pyroscope.jar", "-jar", "/app.jar"]
</code>
FROM eclipse-temurin:21-jre
ENV PYROSCOPE_APPLICATION_NAME=simple.java.app
ENV PYROSCOPE_PROFILING_INTERVAL=10ms
ENV PYROSCOPE_PROFILER_EVENT=cpu
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
ADD https://github.com/grafana/pyroscope-java/releases/download/v0.13.1/pyroscope.jar /pyroscope.jar
ADD cart-api-0.0.2-SNAPSHOT.jar /app.jar
EXPOSE 8080
EXPOSE 8282
CMD ["java", "-XX:-Inline", "-javaagent:pyroscope.jar", "-jar", "/app.jar"]
In my docker-compose I the application container is configured as:
<code> app:
build: app
networks:
- cart
ports:
- "8080:8080"
- "8082:8082"
depends_on:
- tempo
- otel-collector
- loki
- grafana
- prometheus
privileged: true
</code>
<code> app:
build: app
networks:
- cart
ports:
- "8080:8080"
- "8082:8082"
depends_on:
- tempo
- otel-collector
- loki
- grafana
- prometheus
privileged: true
</code>
app:
build: app
networks:
- cart
ports:
- "8080:8080"
- "8082:8082"
depends_on:
- tempo
- otel-collector
- loki
- grafana
- prometheus
privileged: true
In pyroscope I don’t get any information related to the application cpu usage.
Which configuration am I missing?