Documentation ¶
Index ¶
- func Register(name string, f InitFormatter, p InitParser) error
- type Config
- type Formatter
- type FormatterPaths
- type InitFormatter
- type InitParser
- type Parser
- type ParserMon
- func (p *ParserMon) Collect() []exporter.GMetric
- func (p *ParserMon) Configure(cfg Config) error
- func (p *ParserMon) ContainerNotFound()
- func (p *ParserMon) DeleteNotFound()
- func (p *ParserMon) Describe() []exporter.GMetric
- func (p *ParserMon) InvalidPath()
- func (p *ParserMon) LeafNotFound()
- func (p *ParserMon) UpdateDuplicates(dups uint64)
- type Plugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(name string, f InitFormatter, p InitParser) error
Register registers a formatter and parser with the given plugin name. It returns an error if a formatter or parser with the same name has already been registered.
Types ¶
type Formatter ¶
type Formatter interface { Describe() []exporter.GMetric Collect() []exporter.GMetric GetPaths() FormatterPaths ScrapeEvent(ys ygot.GoStruct) func() }
Formatter is an interface that defines the methods required from a formatter object. A formatter object is responsible for building metrics pulling values from the chosen yGot GoStruct.
type FormatterPaths ¶
FormatterPaths represents the paths to be subscribed by the client on behalf of the formatter needs.
type InitFormatter ¶
InitFormatter is a function type that takes a `Config` object as input and returns a `Formatter` and an error. It is used to initialize and register formatters.
type InitParser ¶
InitParser is a function type that takes a `Config` object as input and returns a `Parser` and an error. It is used to initialize and register parsers.
type Parser ¶
type Parser interface { Describe() []exporter.GMetric Collect() []exporter.GMetric CheckOut() ygot.GoStruct ParseNotification(nf *gnmi.Notification) ClearCache() }
Parser represents an interface that defines the methods required from a parser object. A parser object is responsible for loading the received GNMI data into the chosen yGot GoStruct.
type ParserMon ¶
type ParserMon struct { Cfg Config // contains filtered or unexported fields }
func (*ParserMon) Collect ¶
Collect implements the plugin's parser interface. It uses reflection to iterate over the pmCounters struct and creates a new GMetric for each counter.
func (*ParserMon) Configure ¶
Configure takes a Config struct and assigns it to the Cfg field of the ParserMon struct.
func (*ParserMon) ContainerNotFound ¶
func (p *ParserMon) ContainerNotFound()
func (*ParserMon) DeleteNotFound ¶
func (p *ParserMon) DeleteNotFound()
func (*ParserMon) Describe ¶
Describe implements the plugin's parser interface. It returns an GMetric to describe the metric itself.
func (*ParserMon) InvalidPath ¶
func (p *ParserMon) InvalidPath()
func (*ParserMon) LeafNotFound ¶
func (p *ParserMon) LeafNotFound()
func (*ParserMon) UpdateDuplicates ¶
UpdateDuplicates takes an uint64 parameter representing the value of the duplicates field of the update.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin represents a plugin that collects metrics using a formatter and parser.
func (*Plugin) GetDataModels ¶
GetDataModels returns the list of data models associated with the plugin's formatter xPaths.
func (*Plugin) GetMetrics ¶
GetMetrics implements the exporter GMetricSource interface It is called by the exporter, and it sends the output of the formatter object.
func (*Plugin) GetPathsToSubscribe ¶
GetPathsToSubscribe retrieves the list of XPaths that the plugin should subscribe to for data collection.
func (*Plugin) GetPlugName ¶
GetPlugName retrieves the name of the plugin from its configuration.
func (*Plugin) Notification ¶
func (p *Plugin) Notification(nf *gnmi.Notification)
Notification sends the received GNMI notification to the parser, if cache mode is enabled. If Passthrough mode is engaged, notifications are temporarily stored into a buffer. The buffer content is then sent to the parser when a scrape event occurs.