Java APM
StackState Self-hosted v4.5.x
This page describes StackState v4.5.x. The StackState 4.5 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.5 version range to upgrade to a more recent release.
Overview
The Java APM Integration of the Agent V2 StackPack provides tracing support for Java JVM based systems. With this Agent you will get:
All services which can be discovered by our Agent as components
All relations between the different services
Latency, Throughput and Error metric streams on all relations between service components
Heap usage, etc. for all services
This integration will be a part of the Agent V2 StackPack which should be installed as the first step; the rest of the installation instructions will follow soon.
The traces collected by the java trace client are forwarded to the StackState Trace Agent, which in turn forwards it to StackState. This also means that port 7077
should be opened for communication from the StackState Trace Agent.
Java APM is a StackState curated integration.
Automatic Instrumentation
Automatic instrumentation for Java uses the java-agent
instrumentation capabilities provided by the JVM. When the java-agent
is registered, it has the ability to modify class files at the load time. The java-agent
uses the Byte Buddy framework to find the classes defined for instrumentation and modify those class bytes accordingly.
Instrumentation may come from an auto-instrumentation, the OpenTracing api, or a mixture of both. Instrumentation generally captures the following info:
Timing duration is captured using the JVM's nanotime clock unless a timestamp is provided from the OpenTracing api
Key/value tag pairs
Errors and stacktraces which are unhandled by the application
A total count of traces (requests) flowing through the system
Traces Installation
To enable tracing and sending it to Stackstate Trace Agent, you need to follow the below steps to get started.
Download the java trace client and follow the steps below for the different environments.
Traces Installation - VM
Set the following jvm arguments when running your java application
-Dsts.service.name=
{{service-name}}
-Dsts.agent.host=
{{host-of-the-stackstate-agent}}
-Dsts.agent.port=
8126 {the default port for the trace agent api}
-javaagent:
{path/of/downloaded-jar.jar}
Once above steps are done,the java trace client will start sending collected traces to the StackState Trace Agent which will then be forwarded to StackState.
Traces Installation - Docker
Set the following jvm arguments in your
environment
variables when running your container-Dsts.service.name=
{{service-name}}
-Dsts.agent.host=
{{host-of-the-stackstate-agent}}
-Dsts.agent.port=
8126 {the default port for the trace agent api}
-javaagent:
{path/of/downloaded-jar.jar}
Eg. running a container, setting the jvm arguments as part of MAVEN_OPTS
.
Traces Installation - Kubernetes
Set the following jvm arguments in your
env
variables for the container when running your pod-Dsts.service.name=
{{service-name}}
-Dsts.agent.host=
{{host-of-the-stackstate-agent}}
-Dsts.agent.port=
8126 {the default port for the trace agent api}
-javaagent:
{path/of/downloaded-jar.jar}
Eg. running a container in a pod, setting the jvm arguments as part of MAVEN_OPTS
.
Compatibility
StackState officially supports the Java JRE 1.7 and higher versions of both Oracle JDK and OpenJDK. StackState does not officially support any early-access versions of Java.
Web Framework Compatibility
stackstate-java-agent
includes support for automatically tracing the following web frameworks.
Server | Versions | Support Type | Instrumentation Names (used for configuration) |
---|---|---|---|
Akka-Http Server | 10.0+ | Fully Supported |
|
Java Servlet Compatible | 2.3+, 3.0+ | Fully Supported |
|
Jax-RS Annotations | JSR311-API | Fully Supported |
|
Jetty (non-Servlet) | 8+ | Beta |
|
Netty Http Server and Client | 4.0+ | Fully Supported |
|
Play | 2.4-2.6 | Fully Supported |
|
Ratpack | 1.4+ | Beta |
|
Spark Java | 2.3+ | Beta |
|
Spring Web (MVC) | 4.0+ | Fully Supported |
|
Spring WebFlux | 5.0+ | Fully Supported |
|
Vert.x-Web | 4.1.0+ | Fully Supported | (requires |
Web Framework tracing provides: timing HTTP request to response, tags for the HTTP request (status code, method, etc), error and stacktrace capturing, linking work created within a web request and Distributed Tracing.
Note: Many application servers are Servlet compatible and are automatically covered by that instrumentation, such as Tomcat, Jetty, Websphere, Weblogic, etc. Also, frameworks like Spring Boot inherently work because it uses a Servlet compatible embedded application server.
Don't see your desired web frameworks? StackState is continuously adding additional support. Contact our support if you need help.
Networking Framework Compatibility
The stackstate-java-agent
includes support for automatically tracing the following networking frameworks:
Framework | Versions | Support Type | Instrumentation Names (used for configuration) |
---|---|---|---|
Apache HTTP Client | 4.0+ | Fully Supported |
|
Apache HTTP Async Client | 4.0+ | Fully Supported |
|
AWS Java SDK | 1.11+, 2.2+ | Fully Supported |
|
gRPC | 1.5+ | Fully Supported |
|
HttpURLConnection | all | Fully Supported |
|
Kafka-Clients | 0.11+ | Fully Supported |
|
Kafka-Streams | 0.11+ | Fully Supported |
|
Jax RS Clients | 2.0+ | Fully Supported |
|
JMS | 1 and 2 | Fully Supported |
|
Rabbit AMQP | 2.7+ | Fully Supported |
|
OkHTTP | 3.0+ | Fully Supported |
|
Networking tracing provides: timing request to response, tags for the request (e.g. response code), error and stacktrace capturing, and distributed tracing.
Don't see your desired networking framework? StackState is continuously adding additional support. Contact our support if you need help.
Data Store Compatibility
stackstate-java-agent
includes support for automatically tracing the following database frameworks/drivers:
Database | Versions | Support Type | Instrumentation Names (used for configuration) |
---|---|---|---|
Couchbase | 2.0+ | Fully Supported |
|
Cassandra | 3.X | Fully Supported |
|
Elasticsearch Transport | 2.0+ | Fully Supported |
|
Elasticsearch Rest | 5.0+ | Fully Supported |
|
Hibernate | 3.5+ | Fully Supported |
|
JDBC | N/A | Fully Supported |
|
Jedis | 1.4+ | Fully Supported |
|
Lettuce | 5.0+ | Fully Supported |
|
MongoDB | 3.0+ | Fully Supported |
|
SpyMemcached | 2.12+ | Fully Supported |
|
stackstate-java-agent
is also compatible with common JDBC drivers including:
Apache Derby
Firebird SQL
H2 Database Engine
HSQLDB
IBM DB2
MariaDB
MSSQL (Microsoft SQL Server)
MySQL
Oracle
Postgres SQL
Datastore tracing provides: timing request to response, query info (e.g. a sanitized query string), and error and stacktrace capturing.
Don't see your desired datastores? StackState is continuously adding additional support. Contact our support if you need help.
Other Framework Compatibility
stackstate-java-agent
includes support for automatically tracing the following other frameworks:
Framework | Versions | Support Type | Instrumentation Names (used for configuration) |
---|---|---|---|
Slf4J MDC | 1+ | Fully Supported |
|
JSP Rendering | 2.3+ | Fully Supported |
|
Dropwizard Views | 0.7+ | Fully Supported |
|
Hystrix | 1.4+ | Fully Supported |
|
Twilio SDK | 0+ | Fully Supported |
|
Don't see your desired framework? StackState is continuously adding additional support. Contact our support if you need help.
To improve visibility into applications using unsupported frameworks, consider:
Adding custom instrumentation (with OpenTracing or the
@Trace
annotation).Submitting a pull request with the instrumentation for inclusion in a future release.
Contacting our support and submitting a feature request.
Troubleshooting
To troubleshoot the java trace client add the following jvm arguments:
You can also verify whether the StackState Trace Agent has received the traces, by setting the logging level to debug and checking the trace-agent.log
:
stackstate.yaml
In Docker or Kubernetes, set the following environment variable for the StackState Agent
Last updated