metric

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = promlog.New(&promlog.Config{})

Logger - final prometheus logger

Functions

This section is empty.

Types

type CollectOpts

type CollectOpts struct {
	PreventFlood       bool
	SkipApcupsdParsing bool
	Signal             model.Signal
	OnComplete         chan bool
}

CollectOpts ..

type Collector

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

Collector ..

func NewCollector

func NewCollector(opts CollectorOtps) *Collector

NewCollector ..

func (*Collector) Collect

func (c *Collector) Collect(opts CollectOpts)

Collect method

func (*Collector) GetFactory

func (c *Collector) GetFactory() *Factory

GetFactory method

func (*Collector) GetLastOutput

func (c *Collector) GetLastOutput() *apcupsd.Output

GetLastOutput method

func (*Collector) GetModel

func (c *Collector) GetModel() *model.Model

GetModel method

func (*Collector) Start

func (c *Collector) Start()

Start method

type CollectorOtps

type CollectorOtps struct {
	ApcupsdAddr         string
	ApcaccessPath       string
	ApcaccessFloodLimit time.Duration
	CollectInterval     time.Duration
	ApcupsdStartSkip    time.Duration
	Factory             *Factory
	DefaultState        *model.State
}

CollectorOtps ..

type Factory

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

Factory of default metrics

func NewFactory

func NewFactory() *Factory

NewFactory constructor

func (*Factory) GetMetrics

func (f *Factory) GetMetrics() (metrics []*Metric, changed bool)

GetMetrics returns metrics with actual labels

func (*Factory) SetConstLabels

func (f *Factory) SetConstLabels(labels prometheus.Labels)

SetConstLabels method

type Metric

type Metric struct {
	Collector    prometheus.Collector
	HandlerFunc  func(m *Metric, model *model.Model)
	ValFunc      func(m *Metric, model *model.Model) float64
	DefaultValue float64
	IsPermanent  bool
	// contains filtered or unexported fields
}

Metric struct

func (*Metric) Register

func (m *Metric) Register()

Register method

func (*Metric) Unregister

func (m *Metric) Unregister()

Unregister method

func (*Metric) Update

func (m *Metric) Update(curModel *model.Model)

Update method

func (*Metric) UpdateCollector

func (m *Metric) UpdateCollector(val float64)

UpdateCollector method

Jump to

Keyboard shortcuts

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