jaeger-lib icon indicating copy to clipboard operation
jaeger-lib copied to clipboard

Support float64 for gauges

Open vprithvi opened this issue 3 years ago • 1 comments

Requirement

We would like to emit gauge updates with floating numbers (e.g. probabilities)

Problem

The gauge interface in jaeger-lib only supports int64

https://github.com/jaegertracing/jaeger-lib/blob/78a0e7f3cd0c2ab3f747af150d98f534879f09f3/metrics/gauge.go#L18-L21

Implementations like tally, prom, go-kit, influx and expvar support float64 gauges, but jaeger-lib casts the int64 to a float64 value. Is there a reason for this?

https://github.com/jaegertracing/jaeger-lib/blob/78a0e7f3cd0c2ab3f747af150d98f534879f09f3/metrics/prometheus/factory.go#L230-L232

https://github.com/jaegertracing/jaeger-lib/blob/78a0e7f3cd0c2ab3f747af150d98f534879f09f3/metrics/tally/metrics.go#L49-L51

https://github.com/jaegertracing/jaeger-lib/blob/78a0e7f3cd0c2ab3f747af150d98f534879f09f3/metrics/go-kit/metrics.go#L49-L51

Proposal

Update Gauge to use float64 instead of int64 in jaeger-lib 3.0; alternatively jaeger-lib can declare new types GaugeV2, FactoryV2, etc and create an adaptor.

vprithvi avatar Mar 26 '21 13:03 vprithvi

+1, FactoryV2, FloatGauge

I suspect it's for historical reasons, the old statsd based m3 client didn't support floats.

yurishkuro avatar Mar 26 '21 14:03 yurishkuro