jaegertracing / jaeger-lib

A collection of shared infrastructure libraries used by different components of Jaeger.
https://github.com/uber/jaeger
Apache License 2.0
67 stars 35 forks source link

Support float64 for gauges #88

Open vprithvi opened 3 years ago

vprithvi commented 3 years ago

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.

yurishkuro commented 3 years ago

+1, FactoryV2, FloatGauge

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