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

[#674] Made the registry restriction handle newly added metrics. #675

Merged
merged 2 commits into from Jul 1, 2021
Merged

[#674] Made the registry restriction handle newly added metrics. #675

merged 2 commits into from Jul 1, 2021

Conversation

pavel-lexyr
Copy link
Contributor

Fixes #674.

Signed-off-by: Pavel <pavel@lexyr.com>
Copy link
Member

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

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

Generally 👍 with one comment. Thanks!

@@ -58,6 +58,15 @@ def __repr__(self):
self.samples,
)

def restricted_metric(self, names):
Copy link
Member

Choose a reason for hiding this comment

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

Do you think there is a good use case for using this function externally? If not perhaps it should be _restricted_metric so we could easily change/remove it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Good catch!

Signed-off-by: Pavel <pavel@lexyr.com>
Copy link
Member

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

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

Thanks!

@csmarchbanks csmarchbanks merged commit e92fa05 into prometheus:master Jul 1, 2021
for name in names:
if name in self._names_to_collectors:
collectors.add(self._names_to_collectors[name])
for collector in collectors:
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing this code has caused a serious performance regression. The whole point of this feature is not to collect from collectors that aren't needed, so that it's very cheap to access just one or two collectors.

Copy link
Member

Choose a reason for hiding this comment

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

OK, thank you for the context.

@pavel-lexyr perhaps let's approach this by improving the documentation, would you be willing to open a PR to change this back but with more complete documentation?

Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to undo the whole change (even though it is a behaviour change as to when it binds), but the collector lookup is important.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed your concerns in #680. Let me know if you find the implementation agreeable.

csmarchbanks pushed a commit that referenced this pull request Jul 6, 2021
…registry collections (#680)

* Made restricted registries call collect() only on relevant collections.
* Added a skip-if for a test that won't run on Python 2.7.
* Moved yielding target_info out of the lock.
* Fixed style and a race condition.

Signed-off-by: Pavel <pavel@lexyr.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants