mapsink

package module
v0.0.0-...-9bcc2a0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2014 License: Apache-2.0 Imports: 3 Imported by: 1

README

go-metrics-map

GoDocBuild Status

Simple map-based store for go-metrics

Documentation

Overview

Package mapsink provides a simple map-based sink for go-metrics. It does not support intervals, only totals since creation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapSink

type MapSink struct {
	sync.RWMutex
	Data map[string]float32
}

MapSink is a simple sink that stores metrics in a map.

func New

func New() *MapSink

New initializes a new MapSink

func (*MapSink) AddSample

func (s *MapSink) AddSample(key []string, val float32)

AddSample just adds the sampls to all other samples. It acts like a counter in that regard.

func (*MapSink) EmitKey

func (s *MapSink) EmitKey(key []string, val float32)

EmitKey sets the flattend key to the value.

func (*MapSink) FlattenKey

func (s *MapSink) FlattenKey(parts []string) string

FlattenKey flattens the key for formatting, removes spaces

func (*MapSink) Get

func (s *MapSink) Get(key string) (float32, bool)

Get retrieves a single value.

func (*MapSink) IncrCounter

func (s *MapSink) IncrCounter(key []string, val float32)

IncrCounter increments the flattened key by val. If the key does not currently, exist then it is set to val

func (*MapSink) MarshalJSON

func (s *MapSink) MarshalJSON() ([]byte, error)

MarshalJSON marshals the sinks data into json

func (*MapSink) SetGauge

func (s *MapSink) SetGauge(key []string, val float32)

SetGauge sets the flattend key to the value.

Jump to

Keyboard shortcuts

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