exporter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device added in v0.2.0

type Device struct {
	Statistics *models.DeviceStatistics
	*models.DeviceStatusOverview
}

func (*Device) PingMetrics added in v0.2.0

func (dev *Device) PingMetrics() *PingMetrics

type Exporter

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

func New

func New(log logrus.FieldLogger, host string, token string) *Exporter

func (*Exporter) Collect

func (e *Exporter) Collect(out chan<- prom.Metric)

func (*Exporter) CollectContext added in v0.2.0

func (e *Exporter) CollectContext(ctx context.Context, out chan<- prom.Metric)

func (*Exporter) Describe

func (e *Exporter) Describe(out chan<- *prom.Desc)

func (*Exporter) DescribeContext added in v0.2.0

func (e *Exporter) DescribeContext(ctx context.Context, out chan<- *prom.Desc)

func (*Exporter) SetExtras added in v0.2.0

func (e *Exporter) SetExtras(extras []string) error

type ExtraMetrics added in v0.2.0

type ExtraMetrics struct {
	Ping bool
}

ExtraMetrics is used to instruct Exporter to fetch additional metrics, not captured by the UNMS API /devices endpoint.

These metrics may require extra HTTP requests, usually one per device, so it might not be desirable to have them included by default.

Expect this type to gain additional fields in the future. Currently, enabling ping metrics will also fetch (but discard) additional metrics from the /devices/{id}/statitics API endpoint, like temperature, link capacity, and many more values.

type PingHistory added in v0.2.0

type PingHistory []PingResult

PingHistory represents the ping history for a single node/device.

func NewHistory added in v0.2.0

func NewHistory(capacity int) PingHistory

NewHistory creates a new History object with a specific capacity.

func (*PingHistory) Add added in v0.2.0

func (h *PingHistory) Add(rtt time.Duration, lost bool)

AddResult saves a ping result into the internal history.

func (PingHistory) Compute added in v0.2.0

func (h PingHistory) Compute() *PingMetrics

Compute aggregates the result history into a single data point.

type PingMetrics added in v0.2.0

type PingMetrics struct {
	PacketsSent int           // number of packets sent
	PacketsLost int           // number of packets lost
	Best        time.Duration // best RTT
	Worst       time.Duration // worst RTT
	Median      time.Duration // median RTT
	Mean        time.Duration // mean RTT
	StdDev      time.Duration // RTT std deviation
}

PingMetrics is a dumb data point computed from a list of PingResults.

type PingResult added in v0.2.0

type PingResult struct {
	RTT  time.Duration
	Lost bool
}

PingResult stores the information about a single ping, in particular the round-trip time or whether the packet was lost.

Jump to

Keyboard shortcuts

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