metric

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package metric provides the messaging structures specific to metric reporting

Index

Constants

View Source
const (
	MetricString = iota
	MetricBool   = iota
	MetricNumber = iota
	MetricFloat  = iota
)
View Source
const (
	UnitMilliseconds = "MILLISECONDS"
	UnitSeconds      = "SECONDS"
	UnitPercent      = "PERCENT"
)

Variables

This section is empty.

Functions

func UnitToString

func UnitToString(unit int) string

Types

type Metric

type Metric struct {
	Type       int         `json:"-"` // does not export to json
	TypeString string      `json:"type"`
	Dimension  string      `json:"dimension"`
	Name       string      `json:"name"`
	Unit       string      `json:"unit"`
	Value      interface{} `json:"value"`
}

func NewMetric

func NewMetric(name, metricDimension string, internalMetricType int, value interface{}, unit string) *Metric

func NewPercentMetricFromInt

func NewPercentMetricFromInt(name, metricDimension string, portion, total int) *Metric

func (*Metric) ToFloat64

func (m *Metric) ToFloat64() (float64, error)

func (*Metric) ToInt32

func (m *Metric) ToInt32() (int32, error)

func (*Metric) ToInt64

func (m *Metric) ToInt64() (int64, error)

func (*Metric) ToString

func (m *Metric) ToString() (string, error)

func (*Metric) ToUint64

func (m *Metric) ToUint64() (uint64, error)

Jump to

Keyboard shortcuts

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