Jaeger Tracing

Jaeger is used for monitoring and troubleshooting microservices-based distributed systems, including:

  • Distributed context propagation

  • Distributed transaction monitoring

  • Root cause analysis

  • Service dependency analysis

  • Performance/latency optimization

Jaeger Tracing Compatibility

Version 1.0 works on 5.194 - 5.2020.7
Version 1.1 works on 5.2021.1 or higher(MicroProfile 4.x)

Using with Payara Server

To use Jaeger Tracer you will need a wrapper for it - one is provided at Jaeger Tracing Wrapper.

  1. Build the project with

    mvn clean install
  2. Deploy the complete artifact with

    asadmin add-library jaeger-tracer-lib-jar-with-dependencies.jar
  3. Tracing must be enabled with

    asadmin set-requesttracing-configuration --enabled true --dynamic true
    asadmin bootstrap-requesttracing

To view the results of the trace, a Jaeger collector must be available. One can be started easily using docker as follows:

docker run --rm -p 6831:6831/udp -p 6832:6832/udp -p 16686:16686 jaegertracing/all-in-one --log-level=debug

Configuration

Configuration can be done either with environment variables or programmatically in JaegerTracerWrapper

When obtaining a tracer instance using the io.jaegertracing.Configuration#fromEnv() method, values specified via system properties (-DJAEGER_SERVICE_NAME=foo) will override values specified via environment variables.

Table 1. The following property names are available:
Property Required Description

JAEGER_SERVICE_NAME

yes

The service name

JAEGER_AGENT_HOST

no

The hostname for communicating with agent via UDP

JAEGER_AGENT_PORT

no

The port for communicating with agent via UDP

JAEGER_ENDPOINT

no

The traces endpoint, in case the client should connect directly to the Collector, like http://jaeger-collector:14268/api/traces

JAEGER_AUTH_TOKEN

no

Authentication Token to send as "Bearer" to the endpoint

JAEGER_USER

no

Username to send as part of "Basic" authentication to the endpoint

JAEGER_PASSWORD

no

Password to send as part of "Basic" authentication to the endpoint

JAEGER_PROPAGATION

no

Comma separated list of formats to use for propagating the trace context. Defaults to the standard Jaeger format. Valid values are jaeger, b3, and w3c

JAEGER_REPORTER_LOG_SPANS

no

Whether the reporter should also log the spans

JAEGER_REPORTER_MAX_QUEUE_SIZE

no

The reporter’s maximum queue size

JAEGER_REPORTER_FLUSH_INTERVAL

no

The reporter’s flush interval (ms)

JAEGER_SAMPLER_TYPE

no

The sampler type

JAEGER_SAMPLER_PARAM

no

The sampler parameter (number)

JAEGER_SAMPLER_MANAGER_HOST_PORT

no

The host name and port when using the remote controlled sampler

JAEGER_TAGS

no

A comma separated list of name = value tracer level tags, which get added to all reported spans. The value can also refer to an environment variable using the format ${envVarName:default}, where the :default is optional, and identifies a value to be used if the environment variable cannot be found

Setting JAEGER_AGENT_HOST/JAEGER_AGENT_PORT will make the client send traces to the agent via UdpSender. If the JAEGER_ENDPOINT environment variable is also set, the traces are sent to the endpoint, effectively making the JAEGER_AGENT_* vars ineffective.

When the JAEGER_ENDPOINT is set, the HttpSender is used when submitting traces to a remote endpoint, usually served by a Jaeger Collector. If the endpoint is secured, a HTTP Basic Authentication can be performed by setting the related environment vars. Similarly, if the endpoint expects an authentication token, like a JWT, set the JAEGER_AUTH_TOKEN environment variable. If the Basic Authentication environment variables and the Auth Token environment variable are set, Basic Authentication is used.

Define the environment property JAEGER_SERVICE_NAME to override the default jaeger-test value.
Define the environment property JAEGER_AGENT_HOST to override the default localhost