MCPcopy Index your code
hub / github.com/coder/coder / parseExpvarFloat

Function parseExpvarFloat

tailnet/derpmetrics/metrics.go:204–214  ·  view source on GitHub ↗
(v expvar.Var)

Source from the content-addressed store, hash-verified

202}
203
204func parseExpvarFloat(v expvar.Var) (float64, bool) {
205 switch val := v.(type) {
206 case *expvar.Int:
207 return float64(val.Value()), true
208 case *expvar.Float:
209 return val.Value(), true
210 default:
211 f, err := strconv.ParseFloat(v.String(), 64)
212 return f, err == nil
213 }
214}

Callers 3

emitCounterFunction · 0.85
emitGaugeFunction · 0.85
emitLabeledCountersFunction · 0.85

Calls 2

ValueMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected