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

Store prometheus http handlers instead of recreating them for every request #23

Merged
merged 4 commits into from
Nov 24, 2023

Conversation

ToMe25
Copy link
Contributor

@ToMe25 ToMe25 commented Sep 22, 2023

This PR changes the http handler to store the internal http.Handler object for every filter combination, instead of recreating them for every request.

The node exporter only stores the unfiltered one, and recreates the filtered ones, if they are needed.
I believe it is fine to store the filtered ones in this project, because having only 3 collectors means there are 7 filter combinations(plus the unfiltered one) at most.
However I would be fine with recreating the filtered ones, if you believe this isn't worth the additional RAM it uses.

Closes #22

@ToMe25 ToMe25 mentioned this pull request Sep 22, 2023
Copy link
Owner

@lukasmalkmus lukasmalkmus left a comment

Choose a reason for hiding this comment

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

LGTM

@lukasmalkmus lukasmalkmus merged commit 883e453 into lukasmalkmus:master Nov 24, 2023
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.

New registry is created for every request
2 participants