Want to use OpenTelemetry instead? Read these docs to get started!
If your app is written in Java, you can get started quickly with Lightstep. Download the Java SpecialAgent, then configure it to communicate with your Lightstep Satellites. When you deploy your app, all supported third-party framework libraries (like the Elasticsearch client, RxJava, or the Kafka client) will begin sending trace data to Lightstep. The SpecialAgent also collects and reports on infrastructure metrics, communicating directly with the Lightstep Engine.
To ensure you can access all Lightstep functionality, including infrastructure metrics reporting, update the SpecialAgent to the latest release. To update, simply follow the instructions for installing the SpecialAgent. No code changes are needed.
Installation can be static or dynamic, allowing you to install without requiring the application’s source code to be modified or re-compiled.
Supported Java Versions
Java versions 1.7 or later are supported.
Install the Agent
Download the JAR file from Maven.
Configure the Agent to Send Data to Lightstep
To send data from your system to Lightstep, you need to configure the agent to point to your Satellites.
To configure the agent:
- Configure the agent to point to the Lightstep Satellites by setting these environment variables. Use the right values, depending on if you are using on-premise, Lightstep public, or Developer Mode Satellites.
Start tabs
On-Premise Satellites
1
2
3
4
5
6
7
8
9
10
# Options for On Premise Satellites
-Dsa.exporter=lightstep
-Dls.collectorHost=$(your_load_balancer_DNS_name_or_IP_address)
-Dls.collectorProtocol=$(your_satellite_protocol)
-Dls.collectorPort=$(your_satellite_port)
-Dls.accessToken=$(your_Lightstep_token)
-Dls.componentName=${your_service_name}
-Dls.propagator=b3
-Dls.tags="environment=qa-21,version=0.0.201"
Public Satellites
1
2
3
4
5
6
7
8
9
10
# Options for Lightstep Public Satellites
-Dsa.exporter=lightstep
-Dls.collectorHost=ingest.lightstep.com
-Dls.collectorProtocol=https
-Dls.collectorPort=443
-Dls.accessToken=$(your_Lightstep_token)
-Dls.componentName=${your_service_name}
-Dls.propagator=b3
-Dls.tags="environment=qa-21,version=0.0.201"
Developer Mode
1
2
3
4
5
6
7
8
9
10
# Options for Lightstep Public Satellites
-Dsa.exporter=lightstep
-Dls.collectorHost=localhost
-Dls.collectorProtocol=https
-Dls.collectorPort=8360
-Dls.accessToken=$developer
-Dls.componentName=${your_service_name}
-Dls.propagator=b3
-Dls.tags="environment=qa-21,version=0.0.201"
End code tabs
Note the following:
- Your access token is shown in Project Settings. It tells Lightstep which project the agent should send data to.
- The host and port values for on-premise satellites is your pool address, found in your configuration file.
- The
tags
variable allows you to set global tags on all traces. - Lightstep recommends using B3 headers for trace propagation as the default, especially on hybrid deployments, as it is the most widely supported header at this time.
Configure Metrics Reporting
Along with the SpecialAgent collecting telemetry data to report on performance issues and other contextual information to help you with root cause analysis, Lightstep can also ingest and report on infrastructure metrics for a service to further assist in your investigations.
To ensure you can access all Lightstep functionality, including infrastructure metrics reporting, update the SpecialAgent to the latest release. To update, simply follow the instructions for installing the SpecialAgent. No code changes are needed.
The following infrastructure metrics are sent to Lightstep:
- CPU Usage (%)
- Memory (%)
-
Network (bytes)
- Garbage Collection (GC) Count
- GC Time
- Heap Size
These metrics are displayed when you compare performance of a service over two different time periods.
Machine metrics are enabled by default. However, if you use a proxy, you need to set this environment variable to point to the Lightstep endpoint.
-Dls.metricsUrl=http://localhost:8126/metrics
or
-Dls.metricsUrl=<scheme>://<proxy_host>:<proxy_port>/metrics
If you don’t want metrics reported, you can configure the SpecialAgent to turn it off.
To turn metrics off:
Set the following environment variable:
-Dls.disableMetricsReporting=true
Run the Java Special Agent
You can install the agent statically (you will need to restart your app) or dynamically (you can install while the app is running).
Static
For a static attach, use the -javaagent
argument to start up your app.
1
2
3
4
java <application_name>
<options>
-javaagent:$(full_path_to_special_agent_jar)
-jar $(full_path_to_your_jar_file)
Dynamic
For a dynamic attach, you need to determine your application’s PID
and then attach the agent.
Run jps
in a shell to get your PID.
Make sure the SpecialAgent version is correct for your installation.
JDK 1.9 and later:
1
-jar opentracing-specialagent-<version>.jar <PID>
JDK 1.8:
1
2
-Xbootclasspath/a:$JAVA_HOME/lib/tools.jar
-jar opentracing-specialagent-<version>.jar <PID>
All supported OpenTracing plugins are now installed! If you did a dynamic attachment and the third-party apps that have plugins are running, you’ll immediately start to see spans in Lightstep. If you did a static attach, you’ll get spans as soon as your apps are all running.
Read the next section to learn how to configure SpecialAgent to tune the amount of data sent.
Configure Java SpecialAgent Plugins
Java SpecialAgent supports many plugins out of the box. You can add the following additional configuration properties on the command line for plugin configuration.
Set the verbose property
By default, all plugins except Concurrent have this property set to false.
To set all plugins to true:-Dsa.instrumentation.plugins.verbose=true
Or to set individual plugins to true: -Dsa.instrumentation.plugin.${RULE_NAME_PATTERN}.verbose=true
The ${RULE_NAME_PATTERN}
is the artifactId of the plugin, and is shown in the table, below.
Disable a plugin
All plugins are installed by default. You can disable any you don’t need:-Dsa.instrumentation.plugin.${RULE_NAME_PATTERN}.disable
The ${RULE_NAME_PATTERN}
is the artifactId of the plugin, and is shown in the table, below.
Enable a plugin
All plugins are installed by default. If you’ve disabled a plugin, you can re-enable it: -Dsa.instrumentation.plugin.${RULE_NAME_PATTERN}.enable
The ${RULE_NAME_PATTERN}
is the artifactId of the plugin, and is shown in the table, below.
What’s Auto-Instrumented
Following are the supported plugins that are auto-instrumented when you run your app.