ratemap

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2016 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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