Integration with Other Components - jaegertracing/jaeger-lib

Jaeger-lib, a part of the Jaeger project, is a distributed tracing system that helps in monitoring and troubleshooting microservices-based distributed systems. It interacts with other Jaeger components like the backend and the go client to create a cohesive distributed tracing system. This interaction enables Jaeger to provide features like tracing, sampling, and querying distributed transactions.

Jaeger-lib interacts with the Jaeger backend through the Jaeger client. The Jaeger client is responsible for sending spans (units of work done in a distributed system) to the Jaeger backend. The backend components include the Jaeger collector, query, and agent.

The Jaeger go client is a library that provides APIs for creating, sending, and processing spans. Jaeger-lib interacts with the go client to enable tracing of distributed transactions. The go client can be configured to send spans to the Jaeger collector or agent.

Here are the possible options for integrating Jaeger-lib with other Jaeger components:

  1. Jaeger Collector: The Jaeger collector receives spans from Jaeger clients and saves them in persistent storage. The collector can be configured to use different storage backends like Cassandra, Elasticsearch, or memory.

Example:

import (
"github.com/jaegertracing/jaeger-client-go"
"github.com/jaegertracing/jaeger-client-go/config"
)

cfg := &config.Configuration{
ServiceName: "my-service",
Sampler: &config.SamplerConfig{
Type:  "const",
Param: 1,
},
Reporter: &config.ReporterConfig{
LogSpans:           true,
CollectorEndpoint:  "http://my-collector:14268/api/traces",
},
}

jagerClient, closer, err := cfg.NewTracer()
if err != nil {
// handle error
}
defer closer.Close()
  1. Jaeger Agent: The Jaeger agent receives spans from Jaeger clients and forwards them to the collector. The agent can be configured to use different storage backends like Cassandra, Elasticsearch, or memory.

Example:

import (
"github.com/jaegertracing/jaeger-client-go"
"github.com/jaegertracing/jaeger-client-go/config"
)

cfg := &config.Configuration{
ServiceName: "my-service",
Sampler: &config.SamplerConfig{
Type:  "const",
Param: 1,
},
Reporter: &config.ReporterConfig{
LogSpans:           true,
AgentEndpoint:      "localhost:6831",
},
}

jagerClient, closer, err := cfg.NewTracer()
if err != nil {
// handle error
}
defer closer.Close()
  1. Jaeger Query: The Jaeger query service serves the Jaeger UI and an API that retrieves traces from storage.

Example:

import (
"github.com/jaegertracing/jaeger-client-go"
"github.com/jaegertracing/jaeger-client-go/config"
)

cfg := &config.Configuration{
ServiceName: "my-service",
Sampler: &config.SamplerConfig{
Type:  "const",
Param: 1,
},
Reporter: &config.ReporterConfig{
LogSpans:           true,
CollectorEndpoint:  "http://my-collector:14268/api/traces",
},
}

jagerClient, closer, err := cfg.NewTracer()
if err != nil {
// handle error
}
defer closer.Close()

// use jagerClient to create spans and send them to the collector

// query traces using the Jaeger UI or API

Sources: