Class: Datadog::Tracing::Sampling::Sampler Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/tracing/sampling/sampler.rb

Overview

This class is abstract.

Interface for client-side trace sampling.

Direct Known Subclasses

AllSampler, RateByKeySampler, RateSampler

Instance Method Summary collapse

Instance Method Details

#sample!(trace) ⇒ Boolean

Returns ‘true` if the provided trace should be kept. Otherwise, `false`.

This method may modify the ‘trace`, in case changes are necessary based on the sampling decision.

Parameters:

Returns:

  • (Boolean)

    should this trace be kept?

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/datadog/tracing/sampling/sampler.rb', line 17

def sample!(trace)
  raise NotImplementedError, 'Samplers must implement the #sample! method'
end

#sample_rate(trace) ⇒ Float?

The sampling rate, if this sampler has such concept. Otherwise, ‘nil`.

Parameters:

Returns:

  • (Float, nil)

    sampling ratio between 0.0 and 1.0 (inclusive), or ‘nil` if not applicable

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/datadog/tracing/sampling/sampler.rb', line 26

def sample_rate(trace)
  raise NotImplementedError, 'Samplers must implement the #sample_rate method'
end