-
Notifications
You must be signed in to change notification settings - Fork 0
Dual Storage Architecture #5
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
Open
akshayutture-augment
wants to merge
1
commit into
dual-storage-baseline
Choose a base branch
from
dual-storage-enhanced
base: dual-storage-baseline
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
🧩 Analysis chain
Metrics helpers mis-wired and one logging-context inconsistency in Mode3 write paths
There are a few subtle but important inconsistencies in how metrics and logging are wired:
Create error path (Lines 43–46)
On storage failure you record a legacy duration using the storage start time and never record a storage failure metric:
d.recordLegacyDuration(true, mode3Str, options.Kind, method, startStorage)This should be a storage metric to accurately reflect that the error originates from
Storage.Create.Delete success path label mismatch (Line 106)
You record storage duration using
nameinstead ofoptions.Kindfor the “kind” label:d.recordStorageDuration(false, mode3Str, name, method, startStorage)All other methods use
options.Kindin this position, so this will pollute metrics with object names instead of resource kinds.Delete logging context (Line 97)
You build an enriched logger as
log := d.Log.WithValues("name", name, "kind", options.Kind, "method", method)but then attach the base logger to the context:ctx = klog.NewContext(ctx, d.Log)This is inconsistent with Create/Get/List/DeleteCollection/Update and drops the per-call fields from the context logger.
Update error path (Lines 127–130)
On storage failure you again record a legacy duration with the storage start time:
d.recordLegacyDuration(true, mode3Str, options.Kind, method, startStorage)This should be a storage failure metric.
DeleteCollection legacy path (Lines 161–167)
In the legacy goroutine you call
d.recordStorageDurationinstead ofd.recordLegacyDuration:d.recordStorageDuration(err != nil, mode3Str, options.Kind, method, startLegacy)This double-counts storage metrics and never records legacy DeleteCollection timings.
These don’t break functional behavior but will significantly skew observability and make it harder to reason about Mode3 traffic across backends.
A minimal, consistent fix would look like:
Also applies to: 94-117, 120-144, 147-170
I'll verify the review comment by examining the actual code in the repository. Let me retrieve the file and check each claim.
🏁 Script executed:
Length of output: 7431
🏁 Script executed:
Length of output: 6805
All five issues confirmed as accurate; critical metrics and logging inconsistencies need fixing.
Verification of the actual code confirms every claim in the review comment:
Create error path (line 45): Correctly identified—
recordLegacyDurationis used on Storage.Create failure instead ofrecordStorageDuration.Delete label mismatch (line 106): Correctly identified—Delete is the only method using
nameinstead ofoptions.Kindfor the "kind" metric label; all other methods (Create, Get, List, Update, DeleteCollection) useoptions.Kind.Delete logging context (line 97): Correctly identified—Delete attaches base
d.Logto context instead of the enrichedlogcreated on line 96; all other methods attach the enriched logger.Update error path (line 129): Correctly identified—
recordLegacyDurationis used on Storage.Update failure instead ofrecordStorageDuration.DeleteCollection legacy path (line 166): Correctly identified—the legacy goroutine calls
recordStorageDurationwithstartLegacytiming instead ofrecordLegacyDuration, double-counting storage metrics.The suggested fixes in the review are appropriate. These inconsistencies will indeed cause observability issues and misattribution of metrics to the wrong backend paths.
🤖 Prompt for AI Agents