Fix Prometheus Counter anti-pattern: remove _value access - #91
Merged
theinterneti merged 3 commits intoNov 14, 2025
Merged
Conversation
Replace direct access to Counter._value with internal tracking of last exported values. This ensures we follow Prometheus best practices by only using Counter.inc() and never accessing internal implementation details. - Add tracking dictionaries for last exported values - Calculate deltas from tracked values instead of Counter._value - Update request_total, cost_total, and savings_total counters properly - All 57 observability tests pass Co-authored-by: theinterneti <169108167+theinterneti@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update workflow enhancements for observability and API testing
Fix Prometheus Counter anti-pattern: remove _value access
Nov 13, 2025
Owner
|
This PR is relevant to the framework-first strategy but has significant merge conflicts that require manual resolution. |
Resolved conflicts in prometheus_exporter.py by accepting the cleaner implementation from feature/keploy-framework that uses singular variable names (_last_request_total vs _last_request_totals) and more explicit temporary variables (current_total, last_total).
theinterneti
marked this pull request as ready for review
November 14, 2025 01:48
Owner
|
✅ Merge conflicts resolved Merged Resolution Strategy:
The PR is now ready for review and should be mergeable. |
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prometheus Counters were being incorrectly accessed via internal
_valueattribute to calculate deltas. This violates Prometheus design principles where counters should only be incremented.Changes
Counter._value.inc(), never setBefore
After
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.