JBoss OpenTelemetry Instrumentation
This document contains instructions on how to set up OpenTelemetry instrumentation in your JBoss applications and view your application traces in SigNoz.
Requirements
Java 8 or higher
Send Traces to SigNoz Cloud
OpenTelemetry provides a handy Java JAR agent that can be attached to any Java 8+ application and dynamically injects bytecode to capture telemetry from a number of popular libraries and frameworks.
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
From VMs, there are two ways to send data to SigNoz Cloud.
Send traces directly to SigNoz Cloud
OpenTelemetry Java agent can send traces directly to SigNoz Cloud.
Step 1. Download otel java binary agent
wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
Step 2. Open the configuration file
vim /opt/jboss-eap-7.1/bin/standalone.conf
Step 3. Update JAVA_OPTS
environment variable
Update JAVA_OPTS
environment variable with configurations required to send data to SigNoz cloud in your configuration file.
JAVA_OPTS="-javaagent:/path/opentelemetry-javaagent.jar
-Dotel.exporter.otlp.endpoint=https://ingest.<region>.signoz.cloud:443
-Dotel.exporter.otlp.headers="signoz-ingestion-key=<your-ingestion-key>"
-Dotel.resource.attributes="service.name=<service_name>""
You need to replace the following things based on your environment:
path
- Update it to the path of your downloaded Java JAR agent.- Set the
<region>
to match your SigNoz Cloud region - Replace
<your-ingestion-key>
with your SigNoz ingestion key. <service_name>
is name of your service
Step 4. [Optional] Write the output/logs of standalone.sh script to a file nohup.out as a background thread
/opt/jboss-eap-7.1/bin/standalone.sh > /opt/jboss-eap-7.1/bin/nohup.out &
In case you encounter an issue where all applications do not get listed in the services section then please refer to the troubleshooting section.
Send traces via OTel Collector binary
Step 1. Download OTel java binary agent
wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
Step 2. Open the configuration file
vim /opt/jboss-eap-7.1/bin/standalone.conf
Step 3. Update JAVA_OPTS
environment variable
Update JAVA_OPTS
environment variable with configurations required to send data to SigNoz cloud in your configuration file.
JAVA_OPTS="-javaagent:/path/opentelemetry-javaagent.jar"
where,
path
- Update it to the path of your downloaded Java JAR agent.
In case you encounter an issue where all applications do not get listed in the services section then please refer to the troubleshooting section.
Validating instrumentation by checking for traces
With your application running, you can verify that you’ve instrumented your application with OpenTelemetry correctly by confirming that tracing data is being reported to SigNoz.
To do this, you need to ensure that your application generates some data. Applications will not produce traces unless they are being interacted with, and OpenTelemetry will often buffer data before sending. So you need to interact with your application and wait for some time to see your tracing data in SigNoz.
Validate your traces in SigNoz:
- Trigger an action in your app that generates a web request. Hit the endpoint a number of times to generate some data. Then, wait for some time.
- In SigNoz, open the
Services
tab. Hit theRefresh
button on the top right corner, and your application should appear in the list ofApplications
. - Go to the
Traces
tab, and apply relevant filters to see your application’s traces.
You might see other dummy applications if you’re using SigNoz for the first time. You can remove it by following the docs here.
Configuring the agent
The agent is highly configurable. You can check out all the configuration options available here.
Disabled instrumentations
Some instrumentations can produce too many spans and make traces very noisy. For this reason, the following instrumentations are disabled by default:
jdbc-datasource
which creates spans whenever thejava.sql.DataSource#getConnection
method is called.dropwizard-metrics
, which might create very low-quality metrics data because of the lack of label/attribute support in the Dropwizard metrics API.
To enable them, add the otel.instrumentation.<name>.enabled
system property: -Dotel.instrumentation.jdbc-datasource.enabled=true
Troubleshooting your installation
If spans are not being reported to SigNoz, try running in debug mode by setting OTEL_LOG_LEVEL=debug
:
The debug log level will print out the configuration information. It will also emit every span to the console, which should look something like:
Span {
attributes: {},
links: [],
events: [],
status: { code: 0 },
endTime: [ 1597810686, 885498645 ],
_ended: true,
_duration: [ 0, 43333 ],
name: 'bar',
spanContext: {
traceId: 'eca3cc297720bd705e734f4941bca45a',
spanId: '891016e5f8c134ad',
traceFlags: 1,
traceState: undefined
},
parentSpanId: 'cff3a2c6bfd4bbef',
kind: 0,
startTime: [ 1597810686, 885455312 ],
resource: Resource { labels: [Object] },
instrumentationLibrary: { name: 'example', version: '*' },
_logger: ConsoleLogger {
debug: [Function],
info: [Function],
warn: [Function],
error: [Function]
},
_traceParams: {
numberOfAttributesPerSpan: 32,
numberOfLinksPerSpan: 32,
numberOfEventsPerSpan: 128
},
_spanProcessor: MultiSpanProcessor { _spanProcessors: [Array] }
},
*/}
Sample Java Application
- We have included a sample Java application with README.md at Sample Java App Github Repo.