throttling

package
v3.24.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package throttling wraps connections to measure throttling.

Index

Constants

View Source
const BytesReceivedCumulativeOperation = "bytes_received_cumulative"

BytesReceivedCumulativeOperation is the operation we set for network events.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sampler

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

Sampler periodically samples the bytes sent and received by a Trace. The zero value of this structure is invalid; please, construct using NewSampler.

func NewSampler

func NewSampler(tx Trace) *Sampler

NewSampler attaches a *Sampler to a Trace, starts sampling in the background and returns the *Sampler. Remember to call *Sampler.Close to stop the background goroutine that performs the sampling.

func (*Sampler) Close

func (smpl *Sampler) Close() error

Close closes the *Sampler. This method is goroutine safe and idempotent.

func (*Sampler) ExtractSamples

func (smpl *Sampler) ExtractSamples() []*model.ArchivalNetworkEvent

ExtractSamples extracts the samples from the *Sampler

type Trace added in v3.20.0

type Trace interface {
	// CloneBytesReceivedMap returns a clone of the internal bytes received map. The key of the
	// map is a string following the "EPNT_ADDRESS PROTO" pattern where the "EPNT_ADDRESS" contains
	// the endpoint address and "PROTO" is "tcp" or "udp".
	CloneBytesReceivedMap() (out map[string]int64)

	// Index returns the unique index used by this trace.
	Index() int64

	// Tags returns the trace tags.
	Tags() []string

	// TimeSince is equivalent to Trace.TimeNow().Sub(t0).
	TimeSince(t0 time.Time) time.Duration

	// ZeroTime returns the "zero" time of this trace.
	ZeroTime() time.Time
}

Trace is the [*measurexlite.Trace] abstraction used by this package.

Jump to

Keyboard shortcuts

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