Skip to content

use new composable samplers for better sampling #1045

@trentm

Description

@trentm

Support using the new composable samplers for the newer consistent sampling, e.g.:

import {
  createCompositeSampler,
  createComposableAlwaysOffSampler,
  createComposableAlwaysOnSampler,
  createComposableParentThresholdSampler,
  createComposableTraceIDRatioBasedSampler,
} from '@opentelemetry/sampler-composite';

createCompositeSampler(
    createComposableParentThresholdSampler(createComposableTraceIDRatioBasedSampler(0.3)));

Q: Is it a spec break to use this as the default sampler if a sampling rate is given (whether via OTEL_TRACES_SAMPLER_ARG or otherwise)? See https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#general-sdk-configuration and https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling
I think it is fine for us to use the newer composable samplers for all the OTEL_TRACES_SAMPLER known values.

Q2: Would this be wanted upstream as well? Guessing yes.

See #960 for hooking this up to central config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions