feat(auditor): add metrics instrumentation to SetStatus, GetStatus and GetTokenRequest#1677
Open
Rama542 wants to merge 1 commit into
Open
Conversation
f3c20f4 to
5ea734f
Compare
Contributor
Author
…d GetTokenRequest Audit(), Append() and Release() already recorded duration histograms and error counters, but the three query methods SetStatus, GetStatus and GetTokenRequest had no instrumentation at all. In production these are high-frequency calls on the audit path and without metrics operators have no way to detect slow queries or elevated error rates. Add duration histograms and error counters for all three methods using the same pattern already established in the same file, and update the internal metrics tests to reflect the new counter and histogram counts. Signed-off-by: Rama542 <Rama542@users.noreply.github.com>
eb3ac14 to
3bffeac
Compare
Contributor
|
I would like to thanks you a lot for working on that PR. Regards, |
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.
Closes #1674
I was going through the auditor service and noticed something a bit inconsistent.
Audit(), Append() and Release() all have proper duration histograms and error
counters, but the three query methods SetStatus, GetStatus and GetTokenRequest
have nothing at all. In production these are actually called very frequently since
every finality update goes through SetStatus and every audit query hits GetStatus
or GetTokenRequest, so there is a real blind spot there when trying to debug slow
queries or unusual error spikes.
The fix is straightforward since the pattern is already established in the same
file. I added duration histograms and error counters for all three methods and
wired them in exactly the same way Audit() and Append() already do it. No
behaviour changes, purely additive.
Changes:
GetStatusErrors, GetTokenRequestDuration, GetTokenRequestErrors to the
Metrics struct and registered them in newMetrics
GetTokenRequest using the existing start/defer/observe pattern
TestNewMetrics_WithProvider from 3 counters / 2 histograms to 6 counters /
5 histograms, and added the new metric calls to TestMetricsProviderCall
Tests pass and golangci-lint reports 0 issues.