Jaeger Tracing

Helidon is integrated with the Jaeger tracer.

The Jaeger builder is loaded through ServiceLoader and configured. You could also use the Jaeger builder directly, though this would create a source-code dependency on the Jaeger tracer.

Maven Coordinates

To enable Jaeger Tracing add the following dependency to your project’s pom.xml (see Managing Dependencies).

<dependency>
    <groupId>io.helidon.tracing</groupId>
    <artifactId>helidon-tracing-jaeger</artifactId>
</dependency>
Copied

Configuring Jaeger

The Jaeger tracer supports the following configuration options:

KeyDefault valueBuilder methodDescription
serviceN/AserviceNameName of the service, to distinguish traces crossing service boundaries; Jaeger is using lower-case only, name will be automatically lower-cased
protocolhttpcollectorProtocolProtocol of the Jaeger trace collector (udp, http or https), to switch to agent mode, use udp
hostlocalhostcollectorHostHost of the Jaeger trace collector (IP Address, hostname, or FQDN)
port14268collectorPortPort of the Jaeger trace collector
path/api/tracescollectorPathPath of the Jaeger trace collector
tokenN/AtokenAuthentication token to use (token authentication)
usernameN/AusernameUser to authenticate (basic authentication)
passwordN/ApasswordPassword of the user to authenticate (basic authentication)
propagationlibrary defaultaddPropagationPropagation type (jaeger or b3)
log-spanslibrary defaultlogSpansWhether to log spans (boolean)
max-queue-sizelibrary defaultmaxQueueSizeMaximal queue size of the reporter (int)
flush-interval-mslibrary defaultflushIntervalReporter flush interval in milliseconds
sampler-typelibrary defaultsamplerTypeSampler type (probabilistic, ratelimiting, remote)
sampler-paramlibrary defaultsamplerParamNumeric parameter specifying details for the sampler type
sampler-managerlibrary defaultsamplerManagerHost and port of the sampler manager for remote type
enabledtrueenabledIf set to false, tracing would be disabled
tagsN/AaddTracerTag(String, String)String tags to add to each span
boolean-tagsN/AaddTracerTag(String, boolean)boolean tags to add to each span
int-tagsN/AaddTracerTag(String, int)int tags to add to each span

The following is an example of a Jaeger configuration, specified in the YAML format.

tracing:
    service: "helidon-full-http"
    protocol: "https"     # JAEGER_ENDPOINT (if not udp, http is expected and endpoint is filled)
    host: "192.168.1.3"   # JAEGER_ENDPOINT
    port: 14240           # JAEGER_ENDPOINT
    path: "/api/traces/mine"   # JAEGER_ENDPOINT
    token: "token"        # JAEGER_AUTH_TOKEN
    # Either token or username/password
    #username:  "user"     # JAEGER_USER
    #password: "pass"      # JAEGER_PASSWORD
    propagation: "jaeger" # JAEGER_PROPAGATION either "jaeger" or "b3"
    log-spans: false      # JAEGER_REPORTER_LOG_SPANS
    max-queue-size: 42    # JAEGER_REPORTER_MAX_QUEUE_SIZE
    flush-interval-ms: 10001 # JAEGER_REPORTER_FLUSH_INTERVAL
    sampler-type: "remote"# JAEGER_SAMPLER_TYPE (https://www.jaegertracing.io/docs/latest/sampling/#client-sampling-configuration)
    sampler-param: 0.5    # JAEGER_SAMPLER_PARAM (number)
    sampler-manager: "localhost:47877" # JAEGER_SAMPLER_MANAGER_HOST_PORT
    tags:
      tag1: "tag1-value"  # JAEGER_TAGS
      tag2: "tag2-value"  # JAEGER_TAGS
    boolean-tags:
      tag3: true          # JAEGER_TAGS
      tag4: false         # JAEGER_TAGS
    int-tags:
      tag5: 145           # JAEGER_TAGS
      tag6: 741           # JAEGER_TAGS
Copied

Integrating with Jaeger Tracing

Jaeger tracks its own behavior using metrics. See Metrics Support for Jaeger to read how to integrate Jaeger metrics with Helidon.