API Endpoints for jaegertracing/jaeger-lib

Routes Defined in jaegertracing/jaeger-lib

Overview

The jaegertracing/jaeger-lib codebase serves as a collection of shared infrastructure libraries for various components within the Jaeger backend and the jaeger-client-go. The library is implemented primarily in Go but may also include references to other languages and tools. Below are the significant entries that describe routing behavior and how they are defined within this codebase.

Core Components

  1. Metrics Factory (metrics/factory.go)

    The metrics functionality prominently features factories that define namespaces through the Namespace(scope NSOptions) method, returning a nested metrics factory. This includes metrics management across different contexts.

    // Namespace returns a nested metrics factory.
    Namespace(scope NSOptions) Factory
    

    The NSOptions structure captures the name and tags associated with a specific metrics factory namespace.

    // NSOptions defines the name and tags map associated with a factory namespace
    type NSOptions struct {
    Name string
    Tags map[string]string
    }
    
  2. Fork Metrics (metrics/fork/fork.go)

    The Fork factory is a specialized metrics factory that can delegate calls to a secondary factory if the namespace conditions are met. It provides a particular implementation of metrics handling intended to manage multiple metrics backends effectively.

    type Factory struct {
    forkNamespace  string
    forkFactory    metrics.Factory
    defaultFactory metrics.Factory
    }
    
    

    // Namespace implements metrics.Factory interface. func (f *Factory) Namespace(scope metrics.NSOptions) metrics.Factory { if scope.Name == f.forkNamespace { return f.forkFactory.Namespace(scope) }

    return &Factory{ forkNamespace: f.forkNamespace, forkFactory: f.forkFactory.Namespace(scope), defaultFactory: f.defaultFactory.Namespace(scope), } }

  3. Multi Metrics Factory (metrics/multi/multi.go)

    The Multi factory provides the capability to dispatch metrics to multiple backend factories, enhancing the flexibility of how metrics are reported and managed.

    // Factory is a metrics factory that dispatches to multiple metrics backends.
    type Factory struct {
    factories []metrics.Factory
    }
    

Additional Route Specifications

  • Prometheus Integration (metrics/prometheus/factory.go)

    The Prometheus metrics factory implementation allows for metric registration and reporting via the Prometheus registry.

    // Factory implements metrics.Factory backed by Prometheus registry.
    type Factory struct {
    scope      string
    tags       map[string]string
    cache      *vectorCache
    buckets    []float64
    normalizer *strings.Replacer
    separator  Separator
    }
    
  1. Tagless Metrics (metrics/adapters/tagless.go)

    The tagless metrics adapter introduces options for managing metrics without relying on a structured tagging approach.

    // TaglessOptions defines the information associated with a metric
    type TaglessOptions struct {
    Name string
    Help string
    }
    

Conclusion

The routing mechanisms in jaegertracing/jaeger-lib predominantly revolve around the metrics factory methods and their implementations, which are essential for a flexible metrics reporting strategy in the Jaeger ecosystem. The factories are designed to handle different contexts and can be configured dynamically based on the namespace and other parameters. For further exploration of the code base, developers should refer to the primary entry points in the specified Go files.

Source: README.md, Gopkg.toml, metrics/factory.go, metrics/fork/fork.go, metrics/multi/multi.go, metrics/prometheus/factory.go, metrics/adapters/tagless.go