Last active
August 28, 2019 13:01
-
-
Save Cepr0/45b9a240450663dc3e81248be86c3336 to your computer and use it in GitHub Desktop.
Settig up pom.xml for using Elastic APM agent for Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
EAK Docker Compose environment | |
============================== | |
https://github.com/yidinghan/eak | |
Dockerfile example | |
================== | |
FROM openjdk:11-jre-slim | |
VOLUME /tmp | |
WORKDIR /service | |
COPY target/*.jar service.jar | |
COPY target/elastic/elastic-apm-agent.jar elastic-apm-agent.jar | |
ENTRYPOINT exec java -server \ | |
-javaagent:elastic-apm-agent.jar \ | |
$JAVA_OPTS \ | |
-jar service.jar | |
Environment variables reqired to start APM agent in java service | |
================================================================ | |
ELASTIC_APM_SERVICE_NAME=<service name, eg: test-service> | |
ELASTIC_APM_APPLICATION_PACKAGES=<package to collect, eg: com.example> | |
ELASTIC_APM_SERVER_URL=... | |
ELASTIC_APM_SECRET_TOKEN=... | |
--> | |
<!-- Copy elastic apm plugin --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-dependency-plugin</artifactId> | |
<version>3.1.1</version> | |
<executions> | |
<execution> | |
<id>copy</id> | |
<phase>package</phase> | |
<goals> | |
<goal>copy</goal> | |
</goals> | |
</execution> | |
</executions> | |
<configuration> | |
<artifactItems> | |
<artifactItem> | |
<groupId>co.elastic.apm</groupId> | |
<artifactId>elastic-apm-agent</artifactId> | |
<version>RELEASE</version> | |
<type>jar</type> | |
<overWrite>false</overWrite> | |
<outputDirectory>${project.build.directory}/elastic</outputDirectory> | |
<destFileName>elastic-apm-agent.jar</destFileName> | |
</artifactItem> | |
</artifactItems> | |
</configuration> | |
</plugin> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment