Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Sampler

Package version

This interface represent a sampler . This interface represent a sampler. Sampling is a mechanism to control the noise and overhead introduced by OpenTelemetry by reducing the number of samples of traces collected and sent to the backend.

Hierarchy

  • Sampler

Index

Properties

Methods

Properties

description

description: string

A string that uniquely describes the sampling behavior of this instance.

Methods

shouldSample

  • shouldSample(traceId: string): boolean
  • shouldSample(parentContext?: SpanContext): boolean
  • Checks if trace belong the sample.

    Parameters

    • traceId: string

      Used to check the probability.

    Returns boolean

    a boolean. True if the traceId is in probability False if the traceId is not in probability.

  • Checks whether span needs to be created and tracked.

    TODO: Consider to add required arguments https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sampling-api.md#shouldsample

    Parameters

    Returns boolean

    whether span should be sampled or not.

toString

  • toString(): string
  • Returns the sampler name or short description with the configuration.

    Returns string

Generated using TypeDoc