-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix/double call #82
base: master
Are you sure you want to change the base?
Fix/double call #82
Conversation
@coderabbitai full review |
Actions performedFull review triggered. |
WalkthroughThe changes involve modifications to the metric collection and registration logic using the Prometheus client. A new global variable for localized registry management is introduced, and the existing Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
exporter.py (1)
14-14
: Reminder to address the TODO comment.The TODO comment about moving settings to use Flask Configuration Handling is a valuable suggestion for improving the maintainability and scalability of the application. It is recommended to prioritize this task to enhance the configuration management of the application, which could further improve the overall code quality and ease of changes in the future.
Would you like assistance in implementing this configuration handling? I can help draft the necessary changes or open a GitHub issue to track this task.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- exporter.py (3 hunks)
- helpers/prometheus.py (0 hunks)
Files not reviewed due to no reviewable changes (1)
- helpers/prometheus.py
Additional comments not posted (2)
exporter.py (2)
10-10
: Approved changes with a suggestion for documentation.The introduction of
CollectorRegistry
and the new variablesregistry
andcurrent_collector
are well-implemented to address the issue of duplicate API calls. This change ensures that metric collectors are managed more effectively, preventing potential conflicts or duplication.It's recommended to update the README or documentation to reflect these changes, especially explaining the new registry handling and its benefits to future maintainers or users of the code.
Also applies to: 38-39
101-110
: Approved changes with a suggestion for additional testing.The modifications in the
sentry_exporter
function to manage the lifecycle ofSentryCollector
are well-implemented. The logic to unregister the previous collector before registering a new one ensures that metrics collection is accurate and free from duplicates.However, considering that new tests have not been created for these changes, it is highly recommended to add test cases that verify the correct registration and unregistration of collectors. This will help ensure the robustness of the changes and prevent future regressions.
Description
close #65
These changes are intended to create a custom registry to avoid double requests to the Sentry API made using prometheus_client.REGISTRY.
Checklist
Summary by CodeRabbit
clean_registry
function to streamline the metric unregistration process.