package module
Version: v0.14.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 10 Imported by: 3



Package consistent provides a consistent probability based sampler.



This section is empty.


This section is empty.


func ParentProbabilityBased

func ParentProbabilityBased(root sdktrace.Sampler, samplers ...sdktrace.ParentBasedSamplerOption) sdktrace.Sampler

ParentProbabilityBased is an implementation of the OpenTelemetry Trace Sampler interface that provides additional checks for tracestate Probability Sampling fields.

func ProbabilityBased

func ProbabilityBased(fraction float64, opts ...ProbabilityBasedOption) sdktrace.Sampler

ProbabilityBased samples a given fraction of traces. Based on the OpenTelemetry specification, this Sampler supports only power-of-two fractions. When the input fraction is not a power of two, it will be rounded down. - Fractions >= 1 will always sample. - Fractions < 2^-62 are treated as zero.

This Sampler sets the OpenTelemetry tracestate p-value and/or r-value.

To respect the parent trace's `SampledFlag`, this sampler should be used as the root delegate of a `Parent` sampler.

func SemVersion deprecated

func SemVersion() string

SemVersion is the semantic version to be supplied to tracer/meter creation.

Deprecated: Use Version instead.

func Version

func Version() string

Version is the current release version of the consistent probability sampler.


type ProbabilityBasedOption

type ProbabilityBasedOption interface {
	// contains filtered or unexported methods

ProbabilityBasedOption is an option to the ConssitentProbabilityBased sampler.

func WithRandomSource

func WithRandomSource(source rand.Source) ProbabilityBasedOption

WithRandomSource sets the source of the randomness used by the Sampler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL