I need to enable datadog profiling on my spring-boot graalvm service. Prior to graalvm, I only needed to set DD_PROFILING_ENABLED env-var to true. With graalvm it seems not to be that easy. When setting DD_PROFILING_ENABLED=true, dd-agent writes in the logs, that I need to enabled profiling during build time. I'm creating graalvm native binary by running
mvn native:compile
hence, according to the documentation I tried enabling profiling during build by using this configuration in pom.xml:
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
<buildArgs>
<buildArg>-H:+AddAllCharsets</buildArg>
<buildArg>-J-javaagent:${project.basedir}/lib/dd-java-agent-1.34.0.jar</buildArg>
<buildArg>--gc=G1</buildArg>
<buildArg>--pgo=${project.basedir}/service.iprof</buildArg>
<buildArg>-J-Ddd.profiling.enabled=true</buildArg>
</buildArgs>
</configuration>
After compiliation with this parameters, the log line saying that I need to enable profiling during build is gone. However, I still cannot see any profiling data in datadog.
Any hints what might be missing here?
Regards
You are right, you need to enable profiler at build time. To do this, you simply need to add the following arguments in your build configuration:
<buildArg>-J-Ddd.profiling.enabled=true</buildArg>
<buildArg>--enable-monitoring=jfr</buildArg>
The first one will enable Datadog profiler at built time, the second one will make sure JFR is enabled.
Best, Bruce