statscollector

package
v0.0.0-...-2d08fe4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package statscollector implements plugin that collects the statistics from vpp interfaces and publishes them to prometheus.

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is default instance of Plugin.

Functions

This section is empty.

Types

type API

type API interface {
	// RegisterGaugeFunc registers a new gauge with specific name, help string and valueFunc to report status when invoked.
	RegisterGaugeFunc(name string, help string, valueFunc func() float64)
}

API defines API of the stats collector plugin. Currently it only allows registering of a gauge.

type Deps

type Deps struct {
	infra.PluginDeps
	ServiceLabel servicelabel.ReaderAPI
	// IPNet plugin is used to lookup pod connected by the given interface
	IPNet ipnet.API

	// Prometheus plugin used to stream statistics
	Prometheus prometheusplugin.API
}

Deps groups the dependencies of the Plugin.

type Option

type Option func(*Plugin)

Option is a function that acts on a Plugin to inject Dependencies or configuration

func UseDeps

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

type Plugin

type Plugin struct {
	Deps
	sync.Mutex
	// contains filtered or unexported fields
}

Plugin collects the statistics from vpp interfaces and publishes them to prometheus.

func NewPlugin

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provides Options

func (*Plugin) Close

func (p *Plugin) Close() error

Close cleans up the plugin resources

func (*Plugin) HandlesEvent

func (p *Plugin) HandlesEvent(event controller.Event) bool

HandlesEvent selects DeletePod events.

func (*Plugin) Init

func (p *Plugin) Init() error

Init initializes the plugin resources

func (*Plugin) PrintStats

func (p *Plugin) PrintStats()

PrintStats periodically dumps stats to log

func (*Plugin) Put

func (p *Plugin) Put(key string, data proto.Message, opts ...datasync.PutOption) error

Put updates the statistics for the given key

func (*Plugin) RegisterGaugeFunc

func (p *Plugin) RegisterGaugeFunc(name string, help string, valueFunc func() float64)

RegisterGaugeFunc registers a new gauge with specific name, help string and valueFunc to report status when invoked.

func (*Plugin) Resync

Resync is NOOP - statscollector does not support re-synchronization.

func (*Plugin) Revert

func (p *Plugin) Revert(controller.Event) error

Revert is NOOP - only BestEffort DeletePod event is handled.

func (*Plugin) Update

func (p *Plugin) Update(event controller.Event, _ controller.UpdateOperations) (changeDescription string, err error)

Update is called for the DeletePod event.

Jump to

Keyboard shortcuts

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