MCPcopy
hub / github.com/grafana/tempo / NewFloat

Function NewFloat

pkg/usagestats/stats.go:165–174  ·  view source on GitHub ↗

NewFloat returns a new Float stats object. If a Float stats object with the same name already exists it is returned.

(name string)

Source from the content-addressed store, hash-verified

163// NewFloat returns a new Float stats object.
164// If a Float stats object with the same name already exists it is returned.
165func NewFloat(name string) *expvar.Float {
166 existing := expvar.Get(statsPrefix + name)
167 if existing != nil {
168 if f, ok := existing.(*expvar.Float); ok {
169 return f
170 }
171 panic(fmt.Sprintf("%v is set to a non-float value", name))
172 }
173 return expvar.NewFloat(statsPrefix + name)
174}
175
176// NewInt returns a new Int stats object.
177// If an Int stats object with the same name already exists it is returned.

Callers 3

Test_BuildReportFunction · 0.85
Test_BuildStatsFunction · 0.85
TestPanicsFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by 3

Test_BuildReportFunction · 0.68
Test_BuildStatsFunction · 0.68
TestPanicsFunction · 0.68