metrics

package
v0.0.0-...-319d980 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package metrics contains the code for receiving and reporting host metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(id MetricID, value MetricValue)

Add takes a single metric (id and value) from a metric provider. The function buffers the metric and returns immediately.

func AddSlice

func AddSlice(newMetrics []Metric)

AddSlice takes a slice of metrics from a metric provider. The function buffers the metrics and returns immediately.

Here we collect all metrics until the timestamp changes. We then call report() to report all metrics from the previous timestamp.

|----------------- 1s period -------------|
|--+--------------------------+-----------|--+--......
|                          |              |
report(),AddSlice(ID1)     |              |
                           AddSlice(ID2)  |
                                          |
                                          report(),AddSlice(ID1)

This ensures that the buffered metrics from the previous timestamp are sent with the correctly assigned TSMetric.Timestamp.

func SetReporter

func SetReporter(r reporter.MetricsReporter)

SetReporter sets the reporter instance used to send out metrics.

Types

type Metric

type Metric struct {
	ID    MetricID
	Value MetricValue
}

Metric is the type for a metric id/value pair.

type MetricID

type MetricID uint16

MetricID is the type for metric IDs.

type MetricValue

type MetricValue int64

MetricValue is the type for metric values.

type Summary

type Summary map[MetricID]MetricValue

Summary helps summarizing metrics of the same ID from different sources before processing it further.

Directories

Path Synopsis
Package agentmetrics implements the fetching and reporting of agent specific metrics.
Package agentmetrics implements the fetching and reporting of agent specific metrics.
Package reportermetrics implements the fetching and reporting of agent specific metrics.
Package reportermetrics implements the fetching and reporting of agent specific metrics.

Jump to

Keyboard shortcuts

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