@opentelemetry/sampler-jaeger-remote
TypeScript icon, indicating that this package has built-in type declarations

0.55.0 • Public • Published

Jaeger Remote Sampler

NPM Published Version Apache License

Note: This is an experimental package under active development. Minor releases may include breaking changes.

The Jaeger Remote Sampler package is designed for OpenTelemetry to dynamically fetch and update sampling strategies from a Jaeger agent or collector. This enables applications to adjust their sampling strategies based on the current configuration provided by Jaeger, optimizing for both performance and observability.

Installation

npm install --save @opentelemetry/sampler-jaeger-remote

Usage

To integrate the Jaeger Remote Sampler with your application, configure it with the endpoint of your Jaeger agent or collector. The sampler can be set up as follows:

const { JaegerRemoteSampler } = require('@opentelemetry/sampler-jaeger-remote');
const { Resource } = require('@opentelemetry/resources');
const { NodeTracerProvider } = require('@opentelemetry/node');

// Jaeger agent endpoint
const sampler = new JaegerRemoteSampler({
  endpoint: 'http://your-jaeger-agent:14268/api/sampling',
  serviceName: 'your-service-name',
  initialSampler: new AlwaysOnSampler(),
  poolingInterval: 60000  // 60 seconds
});
const provider = new NodeTracerProvider({
  resource: Resource.default().merge(new Resource({
    'service.name': 'your-service-name'
  })),
  sampler
});

provider.register();

Supported Configuration Options

The Jaeger Remote Sampler supports the following sampling strategies based on the configuration received from the remote endpoint:

  1. Per-Operation Sampling: If the remote configuration includes operationSampling with perOperationStrategies, it creates a PerOperationSampler. This allows for different sampling rates for different operations.

  2. Probabilistic Sampling: If the remote configuration specifies StrategyType.PROBABILISTIC, it creates a TraceIdRatioBasedSampler. This samples a percentage of traces based on the trace ID.

  3. Default Sampling: If none of the above apply, it falls back to the initial sampler provided in the constructor.

Useful links

License

Apache 2.0 - See LICENSE for more information.

Dependents (0)

Package Sidebar

Install

npm i @opentelemetry/sampler-jaeger-remote

Weekly Downloads

776

Version

0.55.0

License

Apache-2.0

Unpacked Size

44.7 kB

Total Files

18

Last publish

Collaborators

  • pichlermarc
  • bogdandrutu
  • dyladan