Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider returning the metric on duplicated registration, Error::AlreadyReg #525

Closed
sunng87 opened this issue Jul 4, 2024 · 2 comments
Closed

Comments

@sunng87
Copy link

sunng87 commented Jul 4, 2024

This is similar request to #495

Currently, if we try to register the same metric to registry, we get an error and there is no way to fetch the metric from registry. This make it impossible to reuse the metric. Of course we can get before register but in concurrent scenario it can break.

I haven't looked very deep into the code, but the idea seems to be returning the already registerd metric as a member of Error::AlreadyReg. Also we need to update those macros to ensure that every time we can the macro with legal input, it should return a metric handle.

Context: we hit this issue with opendal apache/opendal#4854 in greptimedb GreptimeTeam/greptimedb#2861

Let me know what do you think. Thank you!

@sunng87 sunng87 changed the title Consider allowing duplicate registration and returning the metric on Error::AlreadyReg Consider returning the metric on duplicated registration, Error::AlreadyReg Jul 4, 2024
@lucab
Copy link
Member

lucab commented Jul 6, 2024

Thanks for the report. If I'm understanding correctly, this request is an exact duplicate of #495. Can we close this duplicate and keep the discussion there? Or is there some important detail that is different here?

@sunng87
Copy link
Author

sunng87 commented Jul 6, 2024

Yes, please. Let me add my comment to #495

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants