sampler

package
v0.15.17-hotfix.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 2 Imported by: 2

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