uber-go / tally

A Go metrics interface with fast buffered metrics and third party reporters
MIT License
850 stars 116 forks source link

Support weight in histogram emitting #175

Open nklijia2011 opened 2 years ago

nklijia2011 commented 2 years ago

I need to emit latency metrics through m3. Is there a way to emit timer metrics or histogram metrics with weight?

Basically, we are emitting how long a single request takes. Sometimes, the request is batching. for example, a batch request with a size of 10, we will calculate how much a single request takes, and emit that 10 times. Wondering whether the api can directly let me set a weight for that timer or histogram, so it knows this is 10 data pointers rather than 1

right now, we can do something like

hist := scope.Histogram(...)

for i := 0; i < 10; i++ {
  hist.Record(val)
}

wondering, whether the API can support something like

hist := scope.Histogram(...)
hist.Record(val, weight = 10)