qtypes_metrics

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

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

The different types of metrics that are supported

Variables

This section is empty.

Functions

func AddToAll

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

AddToAll adds a map of dimensions to a list of metrics

Types

type ContainerStats added in v0.1.6

type ContainerStats struct {
	qtypes_messages.Base
	Stats     *docker.Stats
	Container docker.APIContainers
}

func NewContainerStats added in v0.1.6

func NewContainerStats(src string, stats *docker.Stats, cnt docker.APIContainers) ContainerStats

func (*ContainerStats) GetContainer added in v0.1.6

func (cs *ContainerStats) GetContainer() *types.Container

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)

func NewFilter

func NewFilter(name string, t string, d map[string]string) Filter

NewFilter returns a Filter with compiled regex

func (*Filter) ToJSON

func (f *Filter) ToJSON() string

ToJSON Transforms Filter to JSON

type IntMemoryStats added in v0.1.10

type IntMemoryStats struct {
	qtypes_messages.Base
	Stats        *runtime.MemStats
	NumGoroutine int
}

func NewIntMemoryStats added in v0.1.10

func NewIntMemoryStats(src string) IntMemoryStats

func (*IntMemoryStats) SnapShot added in v0.1.10

func (s *IntMemoryStats) SnapShot()

func (*IntMemoryStats) ToMetrics added in v0.1.10

func (s *IntMemoryStats) ToMetrics(src string) []Metric

type Metric

type Metric struct {
	qtypes_messages.Base
	Name       string            `json:"name"`
	MetricType string            `json:"type"`
	Value      float64           `json:"value"`
	Dimensions map[string]string `json:"dimensions"`
	Buffered   bool              `json:"buffered"`
}

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

func New

func New(source, 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 NewExt

func NewExt(source, name string, metricTyp string, val float64, dimensions map[string]string, t time.Time, buffered bool) Metric

NewExt provides a more controled creation

func WithValue

func WithValue(source, name string, value float64) Metric

WithValue returns metric with value of type Gauge

func (*Metric) AddDimension

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

AddDimension adds a new dimension to the Metric.

func (*Metric) AddDimensions

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

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) GetDimensionList

func (m *Metric) GetDimensionList() string

func (*Metric) GetDimensionString

func (m *Metric) GetDimensionString() string

func (*Metric) GetDimensionValue

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

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

func (*Metric) GetDimensions

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) IsFiltered

func (m *Metric) IsFiltered(f Filter) bool

IsFiltered checks if metrics is filtered with a given filter

func (*Metric) IsSubDim

func (m *Metric) IsSubDim(other map[string]string) bool

IsSubDim checks if the 2st map contains all items in the second

func (*Metric) RemoveDimension

func (m *Metric) RemoveDimension(name string)

RemoveDimension removes a dimension from the Metric.

func (*Metric) SetTime

func (m *Metric) SetTime(mtime time.Time)

SetTime to metric

func (*Metric) ToJSON

func (m *Metric) ToJSON() string

ToJSON Transforms metric to JSON

func (*Metric) ToOpenTSDB

func (m *Metric) ToOpenTSDB() string

func (*Metric) ToOpenTSDBLine added in v0.1.9

func (m *Metric) ToOpenTSDBLine(dropPut bool) string

type OpenTSDBMetric

type OpenTSDBMetric struct {
	Metric    string            `json:"metric"`
	Timestamp int               `json:"timestamp"`
	Value     float64           `json:"value"`
	Tags      map[string]string `json:"tags"`
}

func (*OpenTSDBMetric) String

func (otm *OpenTSDBMetric) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL