0

I have a terraform infra structure project built with FluxCD, that has amongst other things, a spring boot service loaded by a docker image.

What I wanna do is to monitor the JVM of this service with datadog on it's service catalog. No need to create custom metrics etc.

The last layers of this docker image install the DATADOG agent with this:

ARG DATADOG_JAVA_AGENT_VERSION=0.75.0

RUN |1 DATADOG_JAVA_AGENT_VERSION=0.75.0 /bin/sh -c wget --quiet --retry-connrefused --waitretry=1 --read-timeout=10 --timeout=10 --output-document /app/dd-java-agent.jar     https://repository.sonatype.org/service/local/repositories/central-proxy/content/com/datadoghq/dd-java-agent/${DATADOG_JAVA_AGENT_VERSION}/dd-java-agent-${DATADOG_JAVA_AGENT_VERSION}.jar &&     chmod +x /app/dd-java-agent.jar # buildkit

ENTRYPOINT ["java" "-jar" "/app/my-service.jar"]

According to DD documentation:

Download dd-java-agent.jar that contains the latest Agent class files:

wget -O dd-java-agent.jar https://dtdg.co/latest-java-tracer

Add the Java Tracer to the JVM

If you’re adding the -javaagent argument to your java -jar command, it needs to be added before the -jar argument, as a JVM option, not as an application argument. For example:

java -javaagent:/path/to/dd-java-agent.jar -jar my_app.jar

Inside my TF project, I edited this with the following:

-Project
   -infrastructre
      -fluxcd
         -services
             -base
                 - myservice
                     - myService.yaml

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
spec:
   values:
      deployment:
        env:  
          - name: JAVA_OPTS
            value: "${JAVA_OPTS} -javaagent:/app/dd-java-agent.jar -Ddd.logs.injection=true -Ddd.service=myservice -Ddd.env=dev"

And after all this and restarting my service, it still doesn't show up on Datadog's service catalog.

Am I injecting JAVA_OPTS wrong?

Should I add those under, like this?

deployment:
   args:

What am I missing?

0 Answers0