sampler

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 2 Imported by: 5 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rate added in v0.15.0

type Rate float64

Rate is a sample rate.

func (*Rate) UnmarshalYAML added in v0.15.0

func (r *Rate) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals a sample rate.

func (Rate) Validate added in v0.15.0

func (r Rate) Validate() error

Validate validates a sample rate.

func (Rate) Value added in v0.15.0

func (r Rate) Value() float64

Value returns the float64 sample rate value.

type Sampler

type Sampler struct {
	// contains filtered or unexported fields
}

Sampler samples the requests, out of 100 sample calls, 100*sampleRate calls will be sampled.

func NewSampler

func NewSampler(sampleRate Rate) (*Sampler, error)

NewSampler creates a new sampler with a sample rate.

func (*Sampler) Sample

func (t *Sampler) Sample() bool

Sample returns true when the call is sampled.

func (*Sampler) SampleRate added in v0.15.0

func (t *Sampler) SampleRate() Rate

SampleRate returns the effective sample rate.

Jump to

Keyboard shortcuts

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