Conversation
Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
mholt
left a comment
There was a problem hiding this comment.
I don't fully understand this (the metrics stuff in general) but it looks good to me -- no obvious red flags 😅
Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
|
The key I'm using to track uniqueness isn't optimal because a single Caddy module may register multiple collectors. Extracting the unique identifiers using the |
|
That does sound like a tricky one. That's probably fine? We can see if it causes any issues but maybe it's not too likely, or is at least preventable. |
Module developers who add custom metrics are used to wrapping the registration with a
sync.Onceto avoid duplicate registration panic and control the registration. However, the flow ofcaddy reloaddoesn't play nice with this idiom.Since the introduction of registry-per-context, we've told some users to ignore the duplicate registration error if received. However, checking for this particular error is annoying. I wonder if owning the
sync.Onceand tracking the registration is better. I don't know if this is the best flow.