Documentation ¶
Overview ¶
A module for defining a metric schema and auxiliary functions for interacting with it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricType ¶
type MetricType string
const ( Gauge MetricType = "gauge" Counter MetricType = "counter" )
func (MetricType) IsValid ¶
func (mt MetricType) IsValid() bool
type Metrics ¶
type Metrics struct { ID string `json:"id" db:"name"` // имя метрики MType MetricType `json:"type" db:"m_type"` // параметр, принимающий значение gauge или counter Delta *int64 `json:"delta,omitempty" db:"delta,omitempty"` // значение метрики в случае передачи counter Value *float64 `json:"value,omitempty" db:"value,omitempty"` // значение метрики в случае передачи gauge }
Metrics a structure for storing information about metrics.
func (*Metrics) UnmarshalJSON ¶
UnmarshalJSON overriding the standard method to cast to the MetricType type.
func (*Metrics) ValidateType ¶
ValidateType checks the validity of the metric type.
func (*Metrics) ValidateValue ¶
ValidateValue checks the value depending on the type of metric.
Click to show internal directories.
Click to hide internal directories.