Documentation ¶
Overview ¶
Package statsclient is pure Go implementation of VPP stats API client.
Index ¶
- Constants
- Variables
- type Option
- type StatsClient
- func (sc *StatsClient) Connect() (err error)
- func (sc *StatsClient) Disconnect() error
- func (sc *StatsClient) DumpStats(patterns ...string) (entries []adapter.StatEntry, err error)
- func (sc *StatsClient) ListStats(patterns ...string) (entries []adapter.StatIdentifier, err error)
- func (sc *StatsClient) PrepareDir(patterns ...string) (*adapter.StatDir, error)
- func (sc *StatsClient) PrepareDirOnIndex(indexes ...uint32) (*adapter.StatDir, error)
- func (sc *StatsClient) UpdateDir(dir *adapter.StatDir) (err error)
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 ¶
type Option func(*StatsClient)
Option is a StatsClient option
func SetSocketRetryPeriod ¶
SetSocketRetryPeriod is and optional parameter to define a custom retry period while waiting for the VPP socket
func SetSocketRetryTimeout ¶
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 ¶
func (sc *StatsClient) PrepareDir(patterns ...string) (*adapter.StatDir, error)
func (*StatsClient) PrepareDirOnIndex ¶
func (sc *StatsClient) PrepareDirOnIndex(indexes ...uint32) (*adapter.StatDir, error)
Click to show internal directories.
Click to hide internal directories.