exporter

package
v2.0.0-...-4624239 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractExporter

type AbstractExporter struct {
	Class       string
	Name        string
	Logger      *slog.Logger
	Status      uint8
	Message     string
	Options     *options.Options
	Params      conf.Exporter
	Metadata    *matrix.Matrix // metadata about the export
	*sync.Mutex                // mutex to block exporter during export
	// contains filtered or unexported fields
}

AbstractExporter implements all methods of the Exporter interface, except Export() It defines attributes that will be "inherited" by child exporters

func New

func New(c, n string, o *options.Options, p conf.Exporter, params *conf.Poller) *AbstractExporter

New creates an AbstractExporter instance with the given arguments: @c - exporter class @n - exporter name @o - poller options @p - exporter parameters

func (*AbstractExporter) AddExportCount

func (e *AbstractExporter) AddExportCount(n uint64)

AddExportCount adds count n to the export counter

func (*AbstractExporter) GetClass

func (e *AbstractExporter) GetClass() string

GetClass returns the class of the AbstractExporter

func (*AbstractExporter) GetExportCount

func (e *AbstractExporter) GetExportCount() uint64

GetExportCount reports and resets count of exported data points "atomically" this and next methods are only to report the poller how much data we have exported (independent of poll/export interval)

func (*AbstractExporter) GetName

func (e *AbstractExporter) GetName() string

GetName returns the name of the AbstractExporter

func (*AbstractExporter) GetStatus

func (e *AbstractExporter) GetStatus() (uint8, string, string)

GetStatus returns current state of exporter

func (*AbstractExporter) InitAbc

func (e *AbstractExporter) InitAbc() error

InitAbc initializes AbstractExporter

func (*AbstractExporter) SetStatus

func (e *AbstractExporter) SetStatus(code uint8, msg string)

SetStatus sets the current state of exporter

type Exporter

type Exporter interface {
	Init() error      // initialize exporter
	GetClass() string // the class of the exporter, e.g. Prometheus, InfluxDB
	// GetName is different from Class, since we can have multiple instances of the same Class
	GetName() string                      // the name of the exporter instance
	GetExportCount() uint64               // return and reset number of exported data points, used by Poller to keep stats
	AddExportCount(uint64)                // add count to the export count, called by the exporter itself
	GetStatus() (uint8, string, string)   // return current state of the exporter
	Export(*matrix.Matrix) (Stats, error) // render data in matrix to the desired format and emit

}

Exporter defines the required attributes of an exporter All except, Export() are implemented by AbstractExporter

type Stats

type Stats struct {
	InstancesExported uint64
	MetricsExported   uint64
	RenderedBytes     uint64
}

Stats capture the number of instances and metrics exported

Jump to

Keyboard shortcuts

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