census-instrumentation / opencensus-erlang

A stats collection and distributed tracing framework
https://opencensus.io
Apache License 2.0
134 stars 39 forks source link

Stats units #82

Open deadtrickster opened 6 years ago

deadtrickster commented 6 years ago

I think currently units used (in golang, last time I checked) for (self) documentation and in exporters (again, docs?). I think we can do better:

hauleth commented 5 years ago

My idea for that is to support allow oc_stat:record/2-3 to accept tuple in form of {Unit, Value} where Unit can be any atom. Then we could have option to register "unit conversion module" that would have 1 function Module:convert(Value, From, To) :: {ok, Value} | error. Default module would always pass all values if the unit match and fail when there is mismatch. This would provide interface flexible enough for converting between any units, while keeping it quite simple as well.