Installation
Follow the below steps to install Thundra Sidekick SDK to your application.
- Add Thundra agent to the application by setting the
-javaagent
VM argument
In order to configure the agent, you'll need an API key from Thundra Sidekick. You can see your API key in the Welcome Tab.
The Thundra agent can be configured externally through environment variables:
- Configure the Thundra API key by setting the
THUNDRA_APIKEY
environment variable. This configuration is mandatory. - Configure application name by setting the
THUNDRA_AGENT_APPLICATION_NAME
environment variable. This configuration is mandatory. - Configure application stage (local, dev, lab, staging, prod, etc.) by setting the
THUNDRA_AGENT_APPLICATION_STAGE
environment variable. This configuration is optional. - Configure application version (1.0.0, 1.0.1-SNAPSHOT, etc.) by setting the
THUNDRA_AGENT_APPLICATION_VERSION
environment variable. This configuration is optional.
You can configure your distributed tracing setting by using the
THUNDRA_AGENT_TRACE_INSTRUMENT_ENABLE
environment variable. This configuration is optional and set as true
by default. In order to see the distributed trace, it needs to be set as true
by default. If you set false
, Thundra will never collect any of your data. All the data exchange will be between your app and the client over the broker, and distributed tracing integration will be disabled.So, a sample configuration will look like this:
export THUNDRA_APIKEY=<YOUR-THUNDRA-API-KEY>
export THUNDRA_AGENT_APPLICATION_NAME=user-service
export THUNDRA_AGENT_APPLICATION_STAGE=dev
export THUNDRA_AGENT_APPLICATION_VERSION=1.0.1-SNAPSHOT
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. This configuration is mandatory. - Configure the application name by setting the
thundra.agent.application.name
YAML key. This configuration is mandatory. - Configure the application stage (local, dev, lab, staging, prod, etc.) by setting the
thundra.agent.application.stage
YAML key. This configuration is optional. - Configure the application version (1.0.0, 1.0.1-SNAPSHOT, etc.) by setting the
thundra.agent.application.version
YAML key. This configuration is optional.
You can configure your distributed tracing setting by
thundra.agent.trace.instrument.enable
YAML key. This configuration is optional and set astrue
by default. In order to see the distributed trace, it needs to be set astrue
by default. If you set false
, Thundra will never collect any of your data. All the data exchange will be between your app and the client over the broker, and distributed tracing integration will be disabled.So, a sample configuration file
thundra-config.yml
will look like this:thundra:
apiKey: <YOUR-THUNDRA-API-KEY>
agent:
application:
name: user-service
stage: dev
version: 1.0.1-SNAPSHOT
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> \
-e THUNDRA_AGENT_APPLICATION_STAGE=dev \
-e THUNDRA_AGENT_APPLICATION_VERSION=1.0.1-SNAPSHOT \
...
Run the following command to add Thundra to your application.
java -javaagent:<path-to-thundra-agent> -jar <your-app-jar> ...
Last modified 1yr ago