How to avoid metric name collisions across crates? Namespacing? #443
-
AFAICT it's very possible for two different crates to define a metric with the same name, which would likely create some confusion when trying to make sense of the data. Should crates just prefix metric names with "crate_name::" or something? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You're right: it's entirely possible. Right now, the best you can do is to indeed prefix metric names that would otherwise collide. We do have a new (but currently unused) feature that captures "metadata" about where a metric is defined, which includes the target (crate name) and module path (e.g. |
Beta Was this translation helpful? Give feedback.
You're right: it's entirely possible.
Right now, the best you can do is to indeed prefix metric names that would otherwise collide.
We do have a new (but currently unused) feature that captures "metadata" about where a metric is defined, which includes the target (crate name) and module path (e.g.
crate_name::module::submodule
). Using that metadata to automatically prefix metric names would solve this automatically, but it would also be a breaking change and would need to be phased in, so it wouldn't be available to help you out for a while.