metrics-rs / metrics

A metrics ecosystem for Rust.
MIT License
1.13k stars 157 forks source link

Consider adding richer metadata to metric emission. #370

Closed tobz closed 1 year ago

tobz commented 1 year ago

In #338, it was mentioned/implied that metric filtering is harder than it needs to be due to a lack of first-class metadata, such as what tracing provides in its "callsite metadata". This includes high-level things like log level, but also target, module path, and so on.

These additional metadata properties allow users to efficiently filter out, for example, all spans/events from a specific crate or module. In contrast, with metrics, at best, we can filter by metric name and/or labels, which is precarious and involves a priori knowledge of exactly what we want to filter.. whereas tracing's approach can allow (at least far more easily) for filtering via allowlist rather than blocklist.

We should consider what a design might look like to bring this same callsite metadata to metrics.

The primary concerns would roughly be:

tobz commented 1 year ago

/cc @hlbarber @LukeMathWalker