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 ¶
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 ¶
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 ¶
Set writes the given name/rate pair to the map. Set is safe for concurrent access by multiple goroutines.
Source Files ¶
- Version
- v0.13.0 (latest)
- Published
- May 29, 2023
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 10 hours ago –
Tools for package owners.