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

Function NewInt

pkg/usagestats/stats.go:178–187  ·  view source on GitHub ↗

NewInt returns a new Int stats object. If an Int stats object with the same name already exists it is returned.

(name string)

Source from the content-addressed store, hash-verified

176// NewInt returns a new Int stats object.
177// If an Int stats object with the same name already exists it is returned.
178func NewInt(name string) *expvar.Int {
179 existing := expvar.Get(statsPrefix + name)
180 if existing != nil {
181 if i, ok := existing.(*expvar.Int); ok {
182 return i
183 }
184 panic(fmt.Sprintf("%v is set to a non-int value", name))
185 }
186 return expvar.NewInt(statsPrefix + name)
187}
188
189// NewString returns a new String stats object.
190// If a String stats object with the same name already exists it is returned.

Callers 7

cache.goFile · 0.92
shim.goFile · 0.92
ring.goFile · 0.92
app.goFile · 0.92
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