Documentation ¶
Index ¶
- type Device
- type Exporter
- func (e *Exporter) Collect(out chan<- prom.Metric)
- func (e *Exporter) CollectContext(ctx context.Context, out chan<- prom.Metric)
- func (e *Exporter) Describe(out chan<- *prom.Desc)
- func (e *Exporter) DescribeContext(ctx context.Context, out chan<- *prom.Desc)
- func (e *Exporter) SetExtras(extras []string) error
- type ExtraMetrics
- type PingHistory
- type PingMetrics
- type PingResult
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 (*Exporter) CollectContext ¶ added in v0.2.0
func (*Exporter) DescribeContext ¶ added in v0.2.0
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
PingResult stores the information about a single ping, in particular the round-trip time or whether the packet was lost.