Running DataDog agent without using paketo buildpacks when using native images

34 Views Asked by At

I used to integrate datadog with -javaagent:dd-agent.jar. As far as I understand, this is not supported when using graalvm native images. However, paketo buildpacks seem to be able to add dd-agent to a spring-boot app. However, since I'm not using paketo buildpacks, I would like to know if there is another way of integrating DD with native images?

2

There are 2 best solutions below

0
bwest On

Currently there is no way to use the Datadog agent with graal native images. There is an open issue relating to this, and recently an open pull request. I suggest you follow there for potential future solutions.

1
Harry Developer On

Thanks for your answer. Since there is an datadog option for paketo buildpacks, I finally gave it a chance without paketo, too, by using the following maven plugin configuration:

<plugin>
    <groupId>org.graalvm.buildtools</groupId>
    <artifactId>native-maven-plugin</artifactId>
    <configuration>
        <classesDirectory>${project.build.outputDirectory}</classesDirectory>
        <metadataRepository>
            <enabled>true</enabled>
        </metadataRepository>
        <!-- requiredVersion>21.3</requiredVersion -->
        <buildArgs>
            <buildArg>-J-javaagent:lib/dd-java-agent-1.27.0.jar</buildArg>
        </buildArgs>
    </configuration>
    <executions>
        <execution>
            <id>add-reachability-metadata</id>
            <goals>
                <goal>add-reachability-metadata</goal>
            </goals>
        </execution>
    </executions>
</plugin>

and put datadog agent in folder lib. I found that this setup actually does work. Datadog agent is running fine with my native image.