Documentation ¶
Overview ¶
Package metric contains code related to service metrics.
Index ¶
Constants ¶
View Source
const CriticalFailurePercentage = 0.5
CriticalFailurePercentage indicates for a replica metric how many measurements are allowed to fail.
Variables ¶
View Source
var ( // ErrUnknownType indicates that the type is unknown. ErrUnknownType = errors.New("metric: unknown type") // ErrMetricNotFound indicates that the metric was not found. ErrMetricNotFound = errors.New("metric: Metric not found") // ErrTooManyFailedMeasurements indicates that too many measurements failed. ErrTooManyFailedMeasurements = errors.New("metric: Too many failed measurements") )
Functions ¶
This section is empty.
Types ¶
type CPUMeasurer ¶
CPUMeasurer measures the CPU utilization.
type MemoryMeasurer ¶
MemoryMeasurer measures the memory utilization.
type Metric ¶
type Metric struct { // ID of the metric. ID string // Name of the metric. Name string // Type of the metric. Type Type // Kind of the metric. Kind Kind // Prometheus spec. Prometheus PrometheusSpec }
Metric represents a service metric.
type Observer ¶
type Observer struct { startstopper.StartStopper Measurer Measurer Reducer reducer.Reducer Period time.Duration AggregationAmount uint8 // contains filtered or unexported fields }
Observer observes one metric and aggregate measurements.
func NewObserver ¶
NewObserver creates a new Observer for given measurer and reducer.
func (*Observer) AggregatedMetric ¶
AggregatedMetric of current measurements.
type PrometheusMeasurer ¶
type PrometheusMeasurer struct { ServiceID string ServiceName string Metric Metric // contains filtered or unexported fields }
PrometheusMeasurer measures the Prometheus metric.
type PrometheusSpec ¶
type PrometheusSpec struct { // Endpoint of the Prometheus metrics. Endpoint url.URL // Name of the Prometheus metrics. Name string }
PrometheusSpec specifies a Prometheus metric.
Click to show internal directories.
Click to hide internal directories.