kit: github.com/go-kit/kit/metrics/internal/ratemap Index | Files

package ratemap

import "github.com/go-kit/kit/metrics/internal/ratemap"

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

Package Files

ratemap.go

type RateMap Uses

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

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

func New Uses

func New() *RateMap

New returns a new RateMap.

func (*RateMap) Get Uses

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 Uses

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.

Package ratemap imports 1 packages (graph) and is imported by 6 packages. Updated 2016-08-26. Refresh now. Tools for package owners.