@@ -2,21 +2,43 @@ FROM eclipse-temurin:21-jdk
22
33WORKDIR /app
44
5- # Copy and compile the Java source
5+ RUN apt-get update \
6+ && apt-get install -y --no-install-recommends curl ca-certificates \
7+ && rm -rf /var/lib/apt/lists/*
8+
9+ # Install the Datadog Java tracer, which carries the Datadog native Java
10+ # profiler (ddprof). The profiler writes Datadog-specific JFR events such as
11+ # datadog.ExecutionSample; this scenario validates that prof-correctness can
12+ # consume those recordings directly.
13+ RUN curl -fsSL -o /app/dd-java-agent.jar https://dtdg.co/latest-java-tracer
14+
615COPY ./scenarios/java_cpu_jfr/DummyApp.java .
716RUN javac DummyApp.java
817
9- # Force re-run of the next layer when the cache date changes.
10- ARG CACHE_DATE=2024-01-01
11-
12- # EXECUTION_TIME_SEC is injected by the test harness; default to 30 s.
13- ENV EXECUTION_TIME_SEC=30
18+ # EXECUTION_TIME_SEC is injected by the test harness; default to 60 s.
19+ ENV EXECUTION_TIME_SEC=60
1420
15- # Run with built-in JFR.
16- # -XX:+FlightRecorder : enable JFR (no-op on JDK 11+ where it's always on)
17- # -XX:StartFlightRecording=... : start a continuous recording; dump on JVM exit.
18- # settings=profile : enable CPU/alloc/lock profiling at low overhead.
19- CMD java \
20- -XX:+FlightRecorder \
21- "-XX:StartFlightRecording=filename=/app/data/profile.jfr,dumponexit=true,settings=profile,name=correctness" \
22- DummyApp
21+ # Run the app under the Datadog Java profiler and use the tracer's built-in
22+ # debug dump path to persist the JFR snapshot locally. The prof-correctness
23+ # harness finds the timestamped dd-profiler-debug-*.jfr file by regex.
24+ CMD sh -eu -c '\
25+ mkdir -p /app/data/dumps /app/data/tmp; \
26+ java \
27+ -javaagent:/app/dd-java-agent.jar \
28+ -Ddd.service=prof-correctness-java-cpu-jfr \
29+ -Ddd.env=local \
30+ -Ddd.trace.enabled=false \
31+ -Ddd.profiling.enabled=true \
32+ -Ddd.profiling.ddprof.enabled=true \
33+ -Ddd.profiling.ddprof.cpu.enabled=true \
34+ -Ddd.profiling.ddprof.wall.enabled=false \
35+ -Ddd.profiling.upload.period=30 \
36+ -Ddd.profiling.upload.timeout=1 \
37+ -Ddd.profiling.start-force-first=true \
38+ -Ddd.profiling.tempdir=/app/data/tmp \
39+ -Ddd.profiling.debug.dump_path=/app/data/dumps \
40+ -Ddd.profiling.url=http://127.0.0.1:8126/ \
41+ -Ddd.telemetry.enabled=false \
42+ -Ddd.jmxfetch.enabled=false \
43+ DummyApp \
44+ '
0 commit comments