This is the solution (completely instrumented with OpenTelemetry) for the Java demo application used in the Getting Started Guide - Java doc.
Requires:
- Java 17+
- A New Relic account
To run this demo app via the CLI:
- Switch to the
java
directory - Set these two environment variables to send data to your New Relic account:
export OTEL_EXPORTER_OTLP_HEADERS=api-key=<your_license_key>
export OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.nr-data.net:4317
export OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT=4095
- Make sure to use your ingest license key
- If your account is based in the EU, set the endpoint to: https://otlp.eu01.nr-data.net:4317
- Set this environment variable to name the demo app:
export OTEL_SERVICE_NAME=getting-started-java
- Run the following command
../gradlew bootRun
- To generate traffic, in a new terminal tab run the following command
./load-generator.sh
- To shut down the program, run the following in both shells or terminal tabs:
ctrl + c
.