vector icon indicating copy to clipboard operation
vector copied to clipboard

[new_relic sink] actually set the metric type in the metrics API model object

Open jszwedko opened this issue 1 year ago • 4 comments

jszwedko avatar Aug 09 '22 14:08 jszwedko

The models for count metrics are different in New Relic and Vector. While New Relic expects it to contain an interval.ms field, that is, the time during which the metric has been counted, there is no such field in Vector. Looks like for Vector, a count metric represents a single point in time, an event that makes a counter increment or reset. For New Relic, a count metric represents an accumulation of increments that happened during a time interval, and always resets to zero automatically after it is sent. The concepts are different, and thus, I don't think we can directly translate Vector count metrics to New Relic.

For more info on New Relic metric model:

https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/

EDIT:

Actually, because in Vector the count value keeps incrementing and contains the accumulated count (every metric sent contains the previous count value plus the new ones that happened since the last metric was sent), I think it is pretty much akin to the concept of gauge, and it's safe to just send Vector count metrics as New Relic gauge metrics. For New Relic, a gauge is just a value that changes over time, up and down. For Vector a count is a value that changes over time but only up (or zero).

asllop avatar Sep 14 '22 11:09 asllop

@jszwedko please correct me if I'm wrong regarding how Vector count metrics work.

asllop avatar Sep 14 '22 12:09 asllop

Thanks @asllop ! I'm actually curious what @bruceg or @tobz thinks here since they are more familiar with our metrics data model.

jszwedko avatar Sep 16 '22 21:09 jszwedko

We do have a metric normalizer layer for all metrics sinks that can convert any absolute metrics (including counters) into incremental values. We can easily setup this layer to convert counters to incremental values. For the interval, It sounds like storing the previous request time and emitting the difference between that and now may be sufficient, as that would be interval over which the counter has accumulated.

bruceg avatar Sep 16 '22 23:09 bruceg