netsample

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MPL-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ProtoCodeError = 999
)

Variables

This section is empty.

Functions

func WrapAggregator

func WrapAggregator(a Aggregator) core.Aggregator

Types

type Aggregator

type Aggregator interface {
	Run(ctx context.Context, deps core.AggregatorDeps) error
	Report(sample *Sample)
}

func NewPhout

func NewPhout(fs afero.Fs, conf PhoutConfig) (a Aggregator, err error)

func UnwrapAggregator

func UnwrapAggregator(a core.Aggregator) Aggregator

type PhoutConfig

type PhoutConfig struct {
	Destination     string                    // Destination file name
	ID              bool                      // Print ammo ids if true.
	FlushTime       time.Duration             `config:"flush-time"`
	SampleQueueSize int                       `config:"sample-queue-size"`
	Buffer          coreutil.BufferSizeConfig `config:",squash"`
}

func DefaultPhoutConfig

func DefaultPhoutConfig() PhoutConfig

type Sample

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

func Acquire

func Acquire(tag string) *Sample

func (*Sample) AddTag

func (s *Sample) AddTag(tag string)

func (*Sample) Err

func (s *Sample) Err() error

func (*Sample) ID added in v0.3.3

func (s *Sample) ID() int

func (*Sample) ProtoCode

func (s *Sample) ProtoCode() int

func (*Sample) SetErr

func (s *Sample) SetErr(err error)

func (*Sample) SetID added in v0.3.3

func (s *Sample) SetID(id int)

func (*Sample) SetLatency added in v0.3.2

func (s *Sample) SetLatency(d time.Duration)

func (*Sample) SetProtoCode

func (s *Sample) SetProtoCode(code int)

func (*Sample) SetRequestBytes added in v0.3.2

func (s *Sample) SetRequestBytes(b int)

func (*Sample) SetResponceBytes added in v0.3.2

func (s *Sample) SetResponceBytes(b int)

func (*Sample) SetUserDuration added in v0.3.2

func (s *Sample) SetUserDuration(d time.Duration)

func (*Sample) SetUserNet added in v0.3.2

func (s *Sample) SetUserNet(code int)

func (*Sample) SetUserProto added in v0.3.2

func (s *Sample) SetUserProto(code int)

func (*Sample) String

func (s *Sample) String() string

func (*Sample) Tags

func (s *Sample) Tags() string

type TestAggregator

type TestAggregator struct {
	Samples []*Sample
}

func (*TestAggregator) Report

func (t *TestAggregator) Report(s *Sample)

func (*TestAggregator) Run

Jump to

Keyboard shortcuts

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