opentelemetry-js/experimental/packages/sampler-jaeger-remote
Trent Mick 7332f3a863
chore!: bump min-supported node to ^18.19.0 || >=20.6.0 (#5397)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
2025-01-31 09:18:27 +00:00
..
src chore!: update typescript to version `5.0.4` (#5145) 2025-01-09 16:49:52 +00:00
test chore!: update typescript to version `5.0.4` (#5145) 2025-01-09 16:49:52 +00:00
.eslintignore feat(jaeger-remote-sampler): Implement jaeger remote sampler (#4589) 2024-08-23 09:36:51 +00:00
.eslintrc.js feat(jaeger-remote-sampler): Implement jaeger remote sampler (#4589) 2024-08-23 09:36:51 +00:00
.npmignore feat(jaeger-remote-sampler): Implement jaeger remote sampler (#4589) 2024-08-23 09:36:51 +00:00
LICENSE feat(jaeger-remote-sampler): Implement jaeger remote sampler (#4589) 2024-08-23 09:36:51 +00:00
README.md feat(jaeger-remote-sampler): Implement jaeger remote sampler (#4589) 2024-08-23 09:36:51 +00:00
package.json chore!: bump min-supported node to ^18.19.0 || >=20.6.0 (#5397) 2025-01-31 09:18:27 +00:00
tsconfig.json feat(jaeger-remote-sampler): Implement jaeger remote sampler (#4589) 2024-08-23 09:36:51 +00:00

README.md

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.

License

Apache 2.0 - See LICENSE for more information.