Stanislav N. aka pztrn
529113a41a
Metrics data now stored as structures. This is a first step for autodiscovery helping for NMSes. HTTP requests now logged. Got rid of context.Context for getting metric data in applications because context.Context is useless here.
35 lines
677 B
Go
35 lines
677 B
Go
package models
|
|
|
|
// Metric is a generic metric structure.
|
|
type Metric struct {
|
|
// Metric name.
|
|
name string
|
|
// HELP data, if present.
|
|
description string
|
|
// Additional parameters, data inside "{}".
|
|
params []string
|
|
// Metric value.
|
|
value string
|
|
}
|
|
|
|
// NewMetric creates new structure for storing single metric data.
|
|
func NewMetric(name, description string, params []string) Metric {
|
|
m := Metric{
|
|
name: name,
|
|
description: description,
|
|
params: params,
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
// GetValue returns metric's value.
|
|
func (m *Metric) GetValue() string {
|
|
return m.value
|
|
}
|
|
|
|
// SetValue sets value for metric.
|
|
func (m *Metric) SetValue(value string) {
|
|
m.value = value
|
|
}
|