Documentation
¶
Index ¶
- Constants
- func AddToAll(metrics *[]Metric, dims map[string]string)
- type CollectorEmission
- type Filter
- type InternalMetrics
- type Metric
- func (m *Metric) AddDimension(name, value string)
- func (m *Metric) AddDimensions(dimensions map[string]string)
- func (m *Metric) DisableBuffering()
- func (m *Metric) EnableBuffering()
- func (m *Metric) GetDimensionValue(dimension string) (value string, ok bool)
- func (m *Metric) GetDimensions(defaults map[string]string) (dimensions map[string]string)
- func (m *Metric) GetTime() time.Time
- func (m *Metric) IsFiltered(f Filter) bool
- func (m *Metric) IsSubDim(other map[string]string) bool
- func (m *Metric) RemoveDimension(name string)
- func (m *Metric) SetTime(mtime time.Time)
- func (m *Metric) ToJSON() string
- func (m *Metric) ZeroValue() bool
Constants ¶
const ( Gauge = "gauge" Counter = "counter" CumulativeCounter = "cumcounter" )
The different types of metrics that are supported
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CollectorEmission ¶
CollectorEmission counts collector emissions
type Filter ¶
type Filter struct { Name string `json:"name"` MetricType string `json:"type"` Dimensions map[string]string `json:"dimensions"` }
Filter provides a struct that can filter a metric by Name (regex), type, dimension (subset of Dimensions)
type InternalMetrics ¶
InternalMetrics holds the key:value pairs for counters/gauges
func NewInternalMetrics ¶
func NewInternalMetrics() *InternalMetrics
NewInternalMetrics initializes the internal components of InternalMetrics
type Metric ¶
type Metric struct { Name string `json:"name"` MetricType string `json:"type"` Value float64 `json:"value"` Dimensions map[string]string `json:"dimensions"` Buffered bool `json:"buffered"` Time time.Time `json:"time"` }
Metric type holds all the information for a single metric data point. Metrics are generated in collectors and passed to handlers.
func New ¶
New returns a new metric with name. Default metric type is "gauge" and timestamp is set to now. Value is initialized to 0.0.
func (*Metric) AddDimension ¶
AddDimension adds a new dimension to the Metric.
func (*Metric) AddDimensions ¶
AddDimensions adds multiple new dimensions to the Metric.
func (*Metric) DisableBuffering ¶
func (m *Metric) DisableBuffering()
DisableBuffering takes the metric out of buffering (e.g. ZmqBUF)
func (*Metric) EnableBuffering ¶
func (m *Metric) EnableBuffering()
EnableBuffering puts the metric into buffering handlers (e.g. ZmqBUF)
func (*Metric) GetDimensionValue ¶
GetDimensionValue returns the value of a dimension if it's set.
func (*Metric) GetDimensions ¶
GetDimensions returns the dimensions of a metric merged with defaults. Defaults win.
func (*Metric) IsFiltered ¶
IsFiltered checks if metrics is filtered with a given filter
func (*Metric) RemoveDimension ¶
RemoveDimension removes a dimension from the Metric.