-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Sometimes an observed metric is useful internally. I was surprised to see that it wasn't very straightforward to retrieve the current value from a declared Metric variable.
Gauge & etc are already concurrency safe, so it wouldn't make any sense to store the value a second time. But because their state vars are not package-exported (rightfully so), it's not as easy as just calling the same Float64frombits stuff that's used internally.
I think this is the easiest way right now to pull a metric's value back out:
store := new(dto.Metric)
SomeGauge.Write(store) # this call could fail, while the internal float-fetch cannot!
Println("The gauge is reading", *store.Gauge.Value)
It would be nice to just have Gauge.Get() float64
and equivalents instead.
weshouman, ondrejsika and emre-aydin
Metadata
Metadata
Assignees
Labels
No labels