vppcalls

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FallbackToCli defines whether should telemetry handler
	// fallback to parsing stats from CLI output.
	FallbackToCli = false
)
View Source
var Handler = vpp.RegisterHandler(vpp.HandlerDesc{
	Name:       "telemetry",
	HandlerAPI: (*TelemetryVppAPI)(nil),
})

Functions

func AddHandlerVersion

func AddHandlerVersion(version vpp.Version, msgs []govppapi.Message, h NewHandlerFunc)

AddHandlerVersion registers vppcalls Handler for the given version.

func SplitErrorName

func SplitErrorName(str string) (node, reason string)

Types

type BuffersInfo

type BuffersInfo struct {
	Items []BuffersItem `json:"items"`
}

BuffersInfo contains values returned from 'show buffers'

func (*BuffersInfo) GetItems

func (i *BuffersInfo) GetItems() []BuffersItem

GetItems is safe getter for items,

type BuffersItem

type BuffersItem struct {
	ThreadID uint   `json:"thread_id"`
	Name     string `json:"name"`
	Index    uint   `json:"index"`
	Size     uint64 `json:"size"`
	Alloc    uint64 `json:"alloc"`
	Free     uint64 `json:"free"`
	NumAlloc uint64 `json:"num_alloc"`
	NumFree  uint64 `json:"num_free"`
}

BuffersItem represents single buffers item

type MemoryInfo

type MemoryInfo struct {
	Threads []MemoryThread `json:"threads"`
}

MemoryInfo contains memory thread info.

func (*MemoryInfo) GetThreads

func (i *MemoryInfo) GetThreads() []MemoryThread

GetThreads is safe getter for threads,

type MemoryThread

type MemoryThread struct {
	ID              uint   `json:"id"`
	Name            string `json:"name"`
	Size            uint64 `json:"size"`
	Pages           uint64 `json:"pages"`
	PageSize        uint64 `json:"page_size"`
	Total           uint64 `json:"total"`
	Used            uint64 `json:"used"`
	Free            uint64 `json:"free"`
	Trimmable       uint64 `json:"trimmable"`
	FreeChunks      uint64 `json:"free_chunks"`
	FreeFastbinBlks uint64 `json:"free_fastbin_blks"`
	MaxTotalAlloc   uint64 `json:"max_total_allocated"`
}

MemoryThread represents single thread memory counters

type NewHandlerFunc

type NewHandlerFunc func(vpp.Client) TelemetryVppAPI

type NodeCounter

type NodeCounter struct {
	Value uint64 `json:"value"`
	Node  string `json:"node"`
	Name  string `json:"name"`
}

NodeCounter represents single node counter

type NodeCounterInfo

type NodeCounterInfo struct {
	Counters []NodeCounter `json:"counters"`
}

NodeCounterInfo contains node counters info.

func (*NodeCounterInfo) GetCounters

func (i *NodeCounterInfo) GetCounters() []NodeCounter

GetCounters is safe getter for counters,

type RuntimeInfo

type RuntimeInfo struct {
	Threads []RuntimeThread `json:"threads"`
}

RuntimeInfo contains values returned from 'show runtime'

func (*RuntimeInfo) GetThreads

func (i *RuntimeInfo) GetThreads() []RuntimeThread

GetThreads is safe getter for threads.

type RuntimeItem

type RuntimeItem struct {
	Index          uint    `json:"index"`
	Name           string  `json:"name"`
	State          string  `json:"state"`
	Calls          uint64  `json:"calls"`
	Vectors        uint64  `json:"vectors"`
	Suspends       uint64  `json:"suspends"`
	Clocks         float64 `json:"clocks"`
	VectorsPerCall float64 `json:"vectors_per_call"`
}

RuntimeItem represents single runtime item

type RuntimeThread

type RuntimeThread struct {
	ID                  uint          `json:"id"`
	Name                string        `json:"name"`
	Time                float64       `json:"time"`
	AvgVectorsPerNode   float64       `json:"avg_vectors_per_node"`
	LastMainLoops       uint64        `json:"last_main_loops"`
	VectorsPerMainLoop  float64       `json:"vectors_per_main_loop"`
	VectorLengthPerNode float64       `json:"vector_length_per_node"`
	VectorRatesIn       float64       `json:"vector_rates_in"`
	VectorRatesOut      float64       `json:"vector_rates_out"`
	VectorRatesDrop     float64       `json:"vector_rates_drop"`
	VectorRatesPunt     float64       `json:"vector_rates_punt"`
	Items               []RuntimeItem `json:"items"`
}

RuntimeThread represents single runtime thread

type TelemetryStats

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

TelemetryStats is an implementation of TelemetryVppAPI that uses VPP stats API to retrieve the telemetry data.

func NewTelemetryVppStats

func NewTelemetryVppStats(stats govppapi.StatsProvider, teleApi TelemetryVppAPI) *TelemetryStats

func (*TelemetryStats) GetBuffersInfo

func (h *TelemetryStats) GetBuffersInfo(ctx context.Context) (*BuffersInfo, error)

GetBuffersInfo retrieves buffers info from VPP.

func (*TelemetryStats) GetInterfaceStats

func (h *TelemetryStats) GetInterfaceStats(context.Context) (*govppapi.InterfaceStats, error)

GetInterfaceStats retrieves interface stats.

func (*TelemetryStats) GetMemory

func (h *TelemetryStats) GetMemory(ctx context.Context) (*MemoryInfo, error)

GetMemory retrieves `show memory` info. todo switch to stats when memory data will be implemented

func (*TelemetryStats) GetNodeCounters

func (h *TelemetryStats) GetNodeCounters(ctx context.Context) (*NodeCounterInfo, error)

GetNodeCounters retrieves node counters info.

func (*TelemetryStats) GetRuntimeInfo

func (h *TelemetryStats) GetRuntimeInfo(ctx context.Context) (*RuntimeInfo, error)

GetRuntimeInfo retrieves how runtime info.

func (*TelemetryStats) GetSystemStats

func (h *TelemetryStats) GetSystemStats(context.Context) (*govppapi.SystemStats, error)

GetSystemStats retrieves system stats.

func (*TelemetryStats) GetThreads added in v3.2.0

func (h *TelemetryStats) GetThreads(ctx context.Context) (*ThreadsInfo, error)

GetThreads retrieves `show threads` info. todo switch to stats when threads data will be available

type TelemetryVppAPI

type TelemetryVppAPI interface {
	GetSystemStats(context.Context) (*govppapi.SystemStats, error)
	GetMemory(context.Context) (*MemoryInfo, error)
	GetNodeCounters(context.Context) (*NodeCounterInfo, error)
	GetRuntimeInfo(context.Context) (*RuntimeInfo, error)
	GetBuffersInfo(context.Context) (*BuffersInfo, error)
	GetInterfaceStats(context.Context) (*govppapi.InterfaceStats, error)
	GetThreads(ctx context.Context) (*ThreadsInfo, error)
}

TelemetryVppAPI provides API for retrieving telemetry data from VPP.

func CompatibleTelemetryHandler

func CompatibleTelemetryHandler(c vpp.Client) TelemetryVppAPI

CompatibleTelemetryHandler returns the telemetry handler respecting VPP version. It returns the stats API handler when available, or fallbacks to the CLI when requested.

func NewHandler

func NewHandler(c vpp.Client) (TelemetryVppAPI, error)

NewHandler returns the telemetry handler preferring the VPP stats API with CLI/binary API handler injected to retrieve data not included in stats. In case the stats API is not available, CLI handler is returned.

type ThreadsInfo added in v3.2.0

type ThreadsInfo struct {
	Items []ThreadsItem
}

ThreadsInfo contains values returned form `show threads`

func (*ThreadsInfo) GetItems added in v3.2.0

func (i *ThreadsInfo) GetItems() []ThreadsItem

GetItems is safe getter for thread items

type ThreadsItem added in v3.2.0

type ThreadsItem struct {
	Name      string `json:"name"`
	ID        uint32 `json:"id"`
	Type      string `json:"type"`
	PID       uint32 `json:"pid"`
	CPUID     uint32 `json:"cpuid"`
	Core      uint32 `json:"core"`
	CPUSocket uint32 `json:"cpu_socket"`
}

ThreadsItem represents single threads item

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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