What is Jaeger?

Ravi Prakash
3 min readAug 28, 2021

--

Jaeger is a distributed tracing system released as open source by Uber Technologies. It 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

Major Components of Jaeger:

Jaeger Client Libraries — Jaeger clients are language-specific implementations of the OpenTracing API. The OpenTracing API provides a standard, vendor-neutral framework for instrumentation. This means that if a developer wants to try out a different distributed tracing system, then instead of repeating the whole instrumentation process for the new distributed tracing system, the developer can simply change the configuration of the Tracer.

Agent — The Jaeger agent is a network daemon that listens for spans sent over UDP, which it batches and sends to the collector. It is designed to be deployed to all hosts as an infrastructure component. The agent abstracts the routing and discovery of the collectors away from the client.

Collector — The Jaeger collector receives traces from Jaeger agents and runs them through a processing pipeline. Currently, the pipeline validates traces, indexes them, performs transformations, and finally, stores them. Jaeger’s storage is a pluggable component which currently supports Cassandra, Elasticsearch, and Kafka.

Query — Query is a service that retrieves traces from storage and hosts a UI to display them.

Ingester — Ingester is a service that reads from Kafka topic and writes to another storage backend (Cassandra, Elasticsearch).

Architecture of Jaeger:

Sampling

By default, Jaeger clients sample 0.1% of traces (1 in 1000), and have the ability to retrieve sampling strategies from the Jaeger backend. We can aso change the sampling rates with difeerent statergies.

  • Const sampler
  • opentracing.jaeger.const-sampler.decision = true | false
  • Probabilistic sampler
  • opentracing.jaeger.probabilistic-sampler.sampling-rate = value
  • Where value is between 0.0 (no sampling) and 1.0 (sampling of every request)
  • Rate-limiting sampler
  • opentracing.jaeger.rate-limiting-sampler.max-traces-per-second = value
  • Configures that traces are sampled with a certain constant rate. For example, when sampler.param=2.0 it will sample requests with the rate of 2 traces per second.
  • Remote sampler
  • Remote sampler consults Jaeger agent for the appropriate sampling strategy to use in the current service. This allows controlling the sampling strategies in the services from a central configuration in Jaeger backend. It can be configured like so:
  • opentracing.jaeger.remote-controlled-sampler.host-port=localhost:5778

The samplers above are mutually exclusive.

A custom sampler could of course be provided by declaring a bean of type io.jaegertracing.samplers.Sampler

To configure the Jaeger we need to add dependency of Jaeger Client in each and every services (in pom.xml).

Jaeger Client Dependency:

<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-jaeger-web-starter</artifactId>
<version>3.2.0</version>
</dependency>

After adding dependency we need to add Jaeger Client configuration on each services.

@Configuration
public class JaegerConfig {

@Bean
public JaegerTracer jaegerTracer() {
return new io.jaegertracing.Configuration("jaeger-client")
.withSampler(new io.jaegertracing.Configuration.SamplerConfiguration().withType(ConstSampler.TYPE)
.withParam(1))
.withReporter(new io.jaegertracing.Configuration.ReporterConfiguration().withLogSpans(true))
.getTracer();
}
}

We can also change the configurtion according to the Sampling strategy that we are using in the Jaeger. You can refer offical doc for sampling strategy. [1]: https://www.jaegertracing.io/docs/1.22/sampling/

After setup Jaeger Run

docker run -d — name jaeger -p 16686:16686 -p 6831:6831/udp jaegertracing/all-in-one:1.9

Run Jaeger UI on Port 16686.

You can check in github link for the example of Jaeger.

Alternate Option:

There is several more tool which is alternative of jaeger. But one of the popular one is Zipkin.

You can also check related post in Linkedin and Quora.

--

--