netsample

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MPL-2.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ProtoCodeError          = 999
	DiscardedShootCodeError = 777
	DiscardedShootTag       = "discarded"
)

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 MockAggregator added in v0.5.9

type MockAggregator struct {
	mock.Mock
}

MockAggregator is an autogenerated mock type for the Aggregator type

func NewMockAggregator added in v0.5.9

func NewMockAggregator(t mockConstructorTestingTNewMockAggregator) *MockAggregator

NewMockAggregator creates a new instance of MockAggregator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockAggregator) Report added in v0.5.9

func (_m *MockAggregator) Report(sample *Sample)

Report provides a mock function with given fields: sample

func (*MockAggregator) Run added in v0.5.9

Run provides a mock function with given fields: ctx, deps

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 DiscardedShootSample added in v0.4.0

func DiscardedShootSample() *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() uint64

func (*Sample) ProtoCode

func (s *Sample) ProtoCode() int

func (*Sample) SetConnectTime added in v0.5.0

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

func (*Sample) SetErr

func (s *Sample) SetErr(err error)

func (*Sample) SetID added in v0.3.3

func (s *Sample) SetID(id uint64)

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) SetReceiveTime added in v0.5.0

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

func (*Sample) SetRequestBytes added in v0.3.2

func (s *Sample) SetRequestBytes(b int)

func (*Sample) SetResponseBytes added in v0.5.0

func (s *Sample) SetResponseBytes(b int)

func (*Sample) SetSendTime added in v0.5.0

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

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