Provide RegisterMetrics() functions in packages that expose metrics #1428

Open
opened 2025-12-28 17:16:24 +00:00 by sami · 0 comments
Owner

Originally created by @roman-khimov on GitHub (Nov 22, 2024).

I'm always frustrated when I realize that we always register our metrics in init() in every package that exposes them. On one hand it's convenient, but on the other some package users may want to opt out from our metrics.

Describe the solution you'd like

Keep metrics package-level, but expose some RegisterMetrics() function (accepting a registry?) that will do metric registration. Call it in cli/server and everywhere else needed. Keep in mind that variables still need to be initialized properly in every package.

Describe alternatives you've considered

Keep things as is, works too.

Additional context

https://github.com/nspcc-dev/neofs-node/pull/3016
#3682

Originally created by @roman-khimov on GitHub (Nov 22, 2024). ## Is your feature request related to a problem? Please describe. I'm always frustrated when I realize that we always register our metrics in `init()` in every package that exposes them. On one hand it's convenient, but on the other some package users may want to opt out from our metrics. ## Describe the solution you'd like Keep metrics package-level, but expose some `RegisterMetrics()` function (accepting a registry?) that will do metric registration. Call it in cli/server and everywhere else needed. Keep in mind that variables still need to be initialized properly in every package. ## Describe alternatives you've considered Keep things as is, works too. ## Additional context https://github.com/nspcc-dev/neofs-node/pull/3016 #3682
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neo-go#1428
No description provided.