Architecture
The jaeger-lib
library is a collection of shared infrastructure libraries used by different components of the Jaeger backend and jaeger-client-go. The library is not intended to be used standalone, and provides no guarantees of backwards compatibility.
The architecture of jaeger-lib
is based on a modular approach, with different components providing specific functionalities.
Metrics
The metrics
package provides a flexible and extensible framework for instrumenting Jaeger components. The metrics package provides the following features:
- Factory: The
Factory
interface defines a set of methods for creating different types of metrics, including counters, timers, gauges, and histograms. This interface can be implemented by different backend providers. - Namespaces: The
Factory
supports creating nested namespaces. This allows for organizing metrics based on different components or functionalities. - Options: Metrics can be configured with options such as names, tags, and help messages.
- Types: The
metrics
package provides different types of metrics, including:- Counter: Increments a counter.
- Timer: Tracks the duration of events.
- Gauge: Measures a value at a given point in time.
- Histogram: Tracks the distribution of values.
metrics/factory.go, metrics/timer.go
Metric Factory Implementations
The metrics
package includes several different implementations of the Factory
interface, each providing a different backend:
- Tally: The
tally
implementation uses theuber-go/tally
library for metrics. - Go-kit: The
go-kit
implementation uses thego-kit/kit
library for metrics. - Prometheus: The
prometheus
implementation exposes metrics in a Prometheus-compatible format. - Fork: The
fork
implementation allows for creating a metrics factory that delegates to different underlying factories based on the namespace. - Multi: The
multi
implementation allows for creating a metrics factory that aggregates metrics from multiple underlying factories.
metrics/tally/metrics.go, metrics/go-kit/factory.go, metrics/fork/fork.go, metrics/prometheus/factory.go, metrics/multi/multi.go
Testing
The metrics
package includes unit tests for all of its components. The tests use the testify
testing framework and include examples of how to use the metrics
package.
metrics/metricstest/metricstest.go, Gopkg.toml
Building and Running
The jaeger-lib
library can be built and run using the make
utility. The Makefile
includes targets for performing common tasks such as building, testing, and linting the code.
Contributing
Contributions are welcome. Please see the CONTRIBUTING.md file for more information.
License
The jaeger-lib
library is licensed under the Apache 2.0 License.
Top-Level Directory Explanations
metrics/ - This directory contains the metrics implementation for the Jaeger Tracing library.
metrics/adapters/ - This subdirectory contains the various metric adapters for different backends.
metrics/expvar/ - This subdirectory contains the implementation for exposing metrics as HTTP endpoints using the expvar package.
metrics/fork/ - This subdirectory contains the implementation for forking metrics between processes.
metrics/go-kit/ - This subdirectory contains the Go-Kit integration for the Jaeger Tracing library.
metrics/go-kit/expvar/ - This subdirectory contains the expvar implementation for the Go-Kit integration.
metrics/go-kit/influx/ - This subdirectory contains the InfluxDB implementation for the Go-Kit integration.
metrics/metricstest/ - This subdirectory contains the testing implementation for the metrics.
metrics/multi/ - This subdirectory contains the implementation for collecting metrics from multiple sources.
metrics/prometheus/ - This subdirectory contains the Prometheus implementation for the Jaeger Tracing library.
metrics/tally/ - This subdirectory contains the implementation for counting metrics using the tally package.
sample/ - This directory contains a sample implementation for the Jaeger Tracing library.