statsclient

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 15 Imported by: 17 modules, 18 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

Overview

Package statsclient is pure Go implementation of VPP stats API client.

Index

Constants

View Source
const (
	// DefaultSocketName is default VPP stats socket file path.
	DefaultSocketName = adapter.DefaultStatsSocket

	// DefaultSocketRetryPeriod is the time period after the socket availability
	// will be re-checked
	DefaultSocketRetryPeriod = 50 * time.Millisecond

	// DefaultSocketRetryTimeout is the maximum time for the stats socket
	DefaultSocketRetryTimeout = 3 * time.Second
)

Variables

View Source
var (
	MaxWaitInProgress    = time.Millisecond * 100
	CheckDelayInProgress = time.Microsecond * 10
)
View Source
var (
	// Debug is global variable that determines debug mode
	Debug = os.Getenv("DEBUG_GOVPP_STATS") != ""

	// Log is global logger
	Log = logger.New()
)
View Source
var (
	// ErrStatDataLenIncorrect is returned when stat data does not match vector
	// length of a respective data directory
	ErrStatDataLenIncorrect = fmt.Errorf("stat data length incorrect")
)

Functions

This section is empty.

Types

type Option added in v0.4.0

type Option func(*StatsClient)

Option is a StatsClient option

func SetSocketRetryPeriod added in v0.4.0

func SetSocketRetryPeriod(t time.Duration) Option

SetSocketRetryPeriod is and optional parameter to define a custom retry period while waiting for the VPP socket

func SetSocketRetryTimeout added in v0.4.0

func SetSocketRetryTimeout(t time.Duration) Option

SetSocketRetryTimeout is and optional parameter to define a custom timeout while waiting for the VPP socket

type StatsClient

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

StatsClient is the pure Go implementation for VPP stats API.

func NewStatsClient

func NewStatsClient(socket string, options ...Option) *StatsClient

NewStatsClient returns a new StatsClient using socket. If socket is empty string DefaultSocketName is used.

func (*StatsClient) Connect

func (sc *StatsClient) Connect() (err error)

Connect to validated VPP stats socket and start monitoring socket file changes

func (*StatsClient) Disconnect

func (sc *StatsClient) Disconnect() error

Disconnect from the socket, unmap shared memory and terminate socket monitor

func (*StatsClient) DumpStats

func (sc *StatsClient) DumpStats(patterns ...string) (entries []adapter.StatEntry, err error)

func (*StatsClient) ListStats

func (sc *StatsClient) ListStats(patterns ...string) (entries []adapter.StatIdentifier, err error)

func (*StatsClient) PrepareDir added in v0.2.0

func (sc *StatsClient) PrepareDir(patterns ...string) (*adapter.StatDir, error)

func (*StatsClient) PrepareDirOnIndex added in v0.4.0

func (sc *StatsClient) PrepareDirOnIndex(indexes ...uint32) (*adapter.StatDir, error)

func (*StatsClient) UpdateDir added in v0.2.0

func (sc *StatsClient) UpdateDir(dir *adapter.StatDir) (err error)

UpdateDir refreshes directory data for all counters

Jump to

Keyboard shortcuts

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