Skip to content

feat: add option to exclude specific default metrics from collection#689

Open
kwaszczuk wants to merge 2 commits into
prometheus:mainfrom
kwaszczuk:kwaszczuk/exclude-option
Open

feat: add option to exclude specific default metrics from collection#689
kwaszczuk wants to merge 2 commits into
prometheus:mainfrom
kwaszczuk:kwaszczuk/exclude-option

Conversation

@kwaszczuk

@kwaszczuk kwaszczuk commented Jul 11, 2025

Copy link
Copy Markdown

Fixes: #623 (I believe it was incorrectly marked as fixed)

This PR adds exclude option to the DefaultMetricsCollectorConfiguration that allows to omit certain group of metrics from being collected.

My own use case is that I use a custom implementation of eventLoopLag metrics (though based on the original one), so I need to exclude them to avoid conflicts in registry, but others may want to also use it to remove redundant and unused metrics.

An alternative approach would be to expose the exports from lib/metrics in the public interface, allowing users to import and manually register only the specific metrics they need. I’m not sure, though, which approach is better - this one or the exclude approach.

@jdmarshall jdmarshall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@zbjornson @SimenB how do we feel about this one?

@jdmarshall jdmarshall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a changelog entry.

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

Successfully merging this pull request may close these issues.

Provide exclusions for default metrics collected

2 participants