Skip to content

How to avoid metric name collisions across crates? Namespacing? #443

Answered by tobz
bonsairobo asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@bonsairobo
Comment options

@bonsairobo
Comment options

@tobz
Comment options

Answer selected by bonsairobo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants