ratemap

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ratemap implements a goroutine-safe map of string to float64. It can be embedded in implementations whose metrics support fixed sample rates, so that an additional parameter doesn't have to be tracked through the e.g. lv.Space object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateMap

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

RateMap is a simple goroutine-safe map of string to float64.

func New

func New() *RateMap

New returns a new RateMap.

func (*RateMap) Get

func (m *RateMap) Get(name string) float64

Get retrieves the rate for the given name, or 1.0 if none is set. Get is safe for concurrent access by multiple goroutines.

func (*RateMap) Set

func (m *RateMap) Set(name string, rate float64)

Set writes the given name/rate pair to the map. Set is safe for concurrent access by multiple goroutines.

Jump to

Keyboard shortcuts

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