metrics

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package metrics is for maintaining async-safe dict of named values with extra associated with them parameters. A common example is SDK call execution times stored and accessed by method names.

Index

Constants

View Source
const One = 1

One is a constant to be used in MetricsIncrement / MetricsDecrement calls

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector added in v0.8.0

type Collector struct {
	// contains filtered or unexported fields
}

Collector is a main object that stores the values and provides methods for setting and retrieving them,

func NewCollector added in v0.8.0

func NewCollector() *Collector

NewCollector creates and starts a single Collector instance. Instance goroutine is supposed to run thorough the whole lifetime of a program. Multiple independent Collector instances can be run.

func (*Collector) GetMetricsValue added in v0.8.0

func (m *Collector) GetMetricsValue(name string) Item

GetMetricsValue returns a current value for a named parameter.

func (*Collector) MetricsDecrement added in v0.8.0

func (m *Collector) MetricsDecrement(name string, value float64)

MetricsDecrement decreases a named metric for a given value. If a named metric does not exists, it is created and set to 0.

func (*Collector) MetricsIncrement added in v0.8.0

func (m *Collector) MetricsIncrement(name string, value float64)

MetricsIncrement increases a named metric for a given value. If a named metric does not exists, it is created and set to 0.

func (*Collector) SetMetricsValue added in v0.8.0

func (m *Collector) SetMetricsValue(name string, time float64, params interface{})

SetMetricsValue allows to set a named item value, including extra parameters, such as SDK call parameters.

type Item added in v0.8.0

type Item struct {
	Name   string
	Value  float64
	Params interface{}
}

Item is an object containing current value for a given metrics.

Jump to

Keyboard shortcuts

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