fullerite: github.com/Yelp/fullerite/src/fullerite/metric Index | Files

package metric

import "github.com/Yelp/fullerite/src/fullerite/metric"

Index

Package Files

internal_metric.go metric.go

Constants

const (
    Gauge             = "gauge"
    Counter           = "counter"
    CumulativeCounter = "cumcounter"
)

The different types of metrics that are supported

func AddToAll Uses

func AddToAll(metrics *[]Metric, dims map[string]string)

AddToAll adds a map of dimensions to a list of metrics

type CollectorEmission Uses

type CollectorEmission struct {
    Name          string
    EmissionCount uint64
}

CollectorEmission counts collector emissions

type InternalMetrics Uses

type InternalMetrics struct {
    Counters map[string]float64
    Gauges   map[string]float64
}

InternalMetrics holds the key:value pairs for counters/gauges

func NewInternalMetrics Uses

func NewInternalMetrics() *InternalMetrics

NewInternalMetrics initializes the internal components of InternalMetrics

type Metric Uses

type Metric struct {
    Name       string            `json:"name"`
    MetricType string            `json:"type"`
    Value      float64           `json:"value"`
    Dimensions map[string]string `json:"dimensions"`
}

Metric type holds all the information for a single metric data point. Metrics are generated in collectors and passed to handlers.

func New Uses

func New(name string) Metric

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 Sentinel Uses

func Sentinel() Metric

Sentinel returns a sentinel metric, which will force a flush in handler

func WithValue Uses

func WithValue(name string, value float64) Metric

WithValue returns metric with value of type Gauge

func (*Metric) AddDimension Uses

func (m *Metric) AddDimension(name, value string)

AddDimension adds a new dimension to the Metric.

func (*Metric) AddDimensions Uses

func (m *Metric) AddDimensions(dimensions map[string]string)

AddDimensions adds multiple new dimensions to the Metric.

func (*Metric) GetDimensionValue Uses

func (m *Metric) GetDimensionValue(dimension string) (value string, ok bool)

GetDimensionValue returns the value of a dimension if it's set.

func (*Metric) GetDimensions Uses

func (m *Metric) GetDimensions(defaults map[string]string) (dimensions map[string]string)

GetDimensions returns the dimensions of a metric merged with defaults. Defaults win.

func (*Metric) RemoveDimension Uses

func (m *Metric) RemoveDimension(name string)

RemoveDimension removes a dimension from the Metric.

func (*Metric) Sentinel Uses

func (m *Metric) Sentinel() bool

Sentinel is a metric value which forces handler to flush all buffered metrics

func (*Metric) ZeroValue Uses

func (m *Metric) ZeroValue() bool

ZeroValue is metric zero value

Updated 2017-11-02. Refresh now. Tools for package owners.