Core Library Functionality
The jaeger-lib
library provides a set of shared infrastructure components for Jaeger, including tracing, metrics, logging, and utility functions. It is designed to be used by various components of Jaeger backend and jaeger-client-go
, but is not intended to be used standalone.
Tracing
- The library supports distributed tracing and integrates with Jaeger’s tracing system.
- It provides infrastructure for creating spans, reporting traces, and managing sampling strategies.
Metrics
- The library provides a metrics factory (
metrics.Factory
) for creating various types of metrics. - It supports different metrics backends, including:
metrics.NullFactory
: A factory that does not report metrics.metrics.ForkFactory
: A factory that forwards metrics to a specific backend based on namespace.metrics.LocalFactory
: A factory that stores metrics locally.metrics.GoKitFactory
: An adapter that provides a factory for go-kit metrics.metrics.ExpVarFactory
: A go-kit factory that uses expvar for metrics.metrics.InfluxFactory
: A go-kit factory that sends metrics to InfluxDB.
metrics.TaglessFactory
: A factory that provides tagless metrics.
Examples
Creating a namespace with
metrics.NSOptions
:scope := metrics.NSOptions{ Name: "my_namespace", Tags: map[string]string{"service": "my_service"}, }
Using
metrics.ForkFactory
to delegate metrics to different backends:forkFactory := metrics.NewForkFactory("my_fork_namespace", metrics.NewLocalFactory(), metrics.NewNullFactory())
Using
metrics.LocalFactory
to store metrics locally:localFactory := metrics.NewLocalFactory()
Using
metrics.GoKitFactory
to create a factory for go-kit metrics:goKitFactory := metrics.NewGoKitFactory(metrics.NewLocalFactory())
Logging
- The library provides support for logging and integrates with different logging frameworks.
- It offers utilities for configuring logging levels and creating custom loggers.
Utils
- The library includes utility functions for rate limiting, time manipulation, and other common tasks.
Further Information
For more detailed information about the library’s functionality and APIs, refer to the following documentation:
Dependencies
The library depends on several external libraries:
- Go-kit: https://github.com/go-kit/kit
- HdrHistogram: https://github.com/HdrHistogram/hdrhistogram-go
- Tally: https://github.com/uber-go/tally
- Prometheus: https://github.com/prometheus/client_golang
- Testify: https://github.com/stretchr/testify
Important Notes
- This library is not intended to be used standalone.
- There are no guarantees of backwards compatibility.
- The library’s import path is
github.com/uber/jaeger-lib
.
## Top-Level Directory Explanations
<a class='local-link directory-link' data-ref="client/" href="#client/">client/</a> - This directory contains the client-side code for the Jaeger Tracing library.
<a class='local-link directory-link' data-ref="client/log/" href="#client/log/">client/log/</a> - This subdirectory contains the logging implementation for the client-side code.
<a class='local-link directory-link' data-ref="client/log/go-kit/" href="#client/log/go-kit/">client/log/go-kit/</a> - This subdirectory of the logging implementation contains the Go-Kit logging adapter.
<a class='local-link directory-link' data-ref="metrics/" href="#metrics/">metrics/</a> - This directory contains the metrics implementation for the Jaeger Tracing library.
<a class='local-link directory-link' data-ref="metrics/adapters/" href="#metrics/adapters/">metrics/adapters/</a> - This subdirectory contains the various metric adapters for different backends.
<a class='local-link directory-link' data-ref="metrics/expvar/" href="#metrics/expvar/">metrics/expvar/</a> - This subdirectory contains the implementation for exposing metrics as HTTP endpoints using the expvar package.
<a class='local-link directory-link' data-ref="metrics/fork/" href="#metrics/fork/">metrics/fork/</a> - This subdirectory contains the implementation for forking metrics between processes.
<a class='local-link directory-link' data-ref="metrics/go-kit/" href="#metrics/go-kit/">metrics/go-kit/</a> - This subdirectory contains the Go-Kit integration for the Jaeger Tracing library.
<a class='local-link directory-link' data-ref="metrics/go-kit/expvar/" href="#metrics/go-kit/expvar/">metrics/go-kit/expvar/</a> - This subdirectory contains the expvar implementation for the Go-Kit integration.
<a class='local-link directory-link' data-ref="metrics/go-kit/influx/" href="#metrics/go-kit/influx/">metrics/go-kit/influx/</a> - This subdirectory contains the InfluxDB implementation for the Go-Kit integration.
<a class='local-link directory-link' data-ref="metrics/metricstest/" href="#metrics/metricstest/">metrics/metricstest/</a> - This subdirectory contains the testing implementation for the metrics.
<a class='local-link directory-link' data-ref="metrics/prometheus/" href="#metrics/prometheus/">metrics/prometheus/</a> - This subdirectory contains the Prometheus implementation for the Jaeger Tracing library.
<a class='local-link directory-link' data-ref="metrics/tally/" href="#metrics/tally/">metrics/tally/</a> - This subdirectory contains the implementation for counting metrics using the tally package.
<a class='local-link directory-link' data-ref="sample/" href="#sample/">sample/</a> - This directory contains a sample implementation for the Jaeger Tracing library.
<a class='local-link directory-link' data-ref="scripts/" href="#scripts/">scripts/</a> - This directory contains various scripts for the project.
<a class='local-link directory-link' data-ref="utils/" href="#utils/">utils/</a> - This directory contains various utility functions for the project.