1 // Package ratemap implements a goroutine-safe map of string to float64. It can
2 // be embedded in implementations whose metrics support fixed sample rates, so
3 // that an additional parameter doesn't have to be tracked through the e.g.
9 // RateMap is a simple goroutine-safe map of string to float64.
15 // New returns a new RateMap.
18 m: map[string]float64{},
22 // Set writes the given name/rate pair to the map.
23 // Set is safe for concurrent access by multiple goroutines.
24 func (m *RateMap) Set(name string, rate float64) {
30 // Get retrieves the rate for the given name, or 1.0 if none is set.
31 // Get is safe for concurrent access by multiple goroutines.
32 func (m *RateMap) Get(name string) float64 {