Integration Options for Java SDK in Containers and VMs
In order to configure the agent, you'll need an API key from Thundra APM.
The Thundra agent can be configured externally through environment variables:
- Configure the Thundra API key by setting the
THUNDRA_APIKEY
environment variable. - Configure application name by setting the
THUNDRA_AGENT_APPLICATION_NAME
environment variable.
So, a sample configuration will look like this:
export THUNDRA_APIKEY=<YOUR-THUNDRA-API-KEY>
export THUNDRA_AGENT_APPLICATION_NAME=user-service
Thundra agent can be configured through a YAML formatted configuration file named
thundra-config.yml
in the classpath (for example the config file might be located under src/main/resources
directory):- Configure the Thundra API key by setting the
thundra.apiKey
YAML key. - Configure the application name by setting the
thundra.agent.application.name
YAML key.
So, a sample configuration file
thundra-config.yml
will look like this:thundra:
apiKey: <YOUR-THUNDRA-API-KEY>
agent:
application:
name: user-service
Here you can see a sample Docker configuration. It may differ from your own Docker configuration. You need to modify this sample according to your own Docker configuration.
FROM openjdk:8
RUN mkdir -p /app
# Copy app artifact
ADD target/<Your-App>.jar /app/<Your-App>.jar
# Copy Thundra bootstrap agent artifact.
# Please rename with the file you have downloaded at the first step.
ADD thundra-agent-bootstrap.jar /app/thundra-agent-bootstrap.jar
WORKDIR /app
EXPOSE 8080
ENTRYPOINT [ "java", "-javaagent:thundra-agent-bootstrap.jar", "-jar", "<Your-App>.jar" ]
You can use the example below if you would like to use environment variables with
docker run
docker run ... \
-e THUNDRA_APIKEY=<YOUR-THUNDRA-API-KEY> \
-e THUNDRA_AGENT_APPLICATION_NAME=<YOUR-APP-NAME> \
...
Run the following command to add Thundra to your application.
java -javaagent:<path-to-thundra-agent> -jar <your-app-jar> ...