-
Notifications
You must be signed in to change notification settings - Fork 867
Add more metrics for snapshot and state sync #2879
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
yzang2019
wants to merge
7
commits into
main
Choose a base branch
from
yang/add-metrics-statesync
base: main
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
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f4412bf
Add one more metric for state sync
yzang2019 b26dca2
Add more metrics for snapshot creation
yzang2019 d629834
Add prune latency metrics
yzang2019 3a9ac25
Add pruning count metrics
yzang2019 7ef48f1
Merge branch 'main' into yang/add-metrics-statesync
yzang2019 c52b76a
Address comments
yzang2019 ab38167
Address comments
yzang2019 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -682,15 +682,7 @@ type snapshotWriter struct { | |
| wg sync.WaitGroup // Wait for all writer goroutines | ||
|
|
||
| // Pipeline metrics for each channel | ||
| maxKvFill int | ||
| maxLeafFill int | ||
| maxBranchFill int | ||
| kvFillSum int64 | ||
| leafFillSum int64 | ||
| branchFillSum int64 | ||
| kvFillCount int64 | ||
| leafFillCount int64 | ||
| branchFillCount int64 | ||
|
|
||
| lastMetricsReport time.Time | ||
| } | ||
|
|
||
|
|
@@ -864,22 +856,6 @@ func (w *snapshotWriter) writeKeyValueDirect(key, value []byte) error { | |
|
|
||
| // writeLeaf sends leaf and KV write operations to the pipeline | ||
| func (w *snapshotWriter) writeLeaf(version uint32, key, value, hash []byte) error { | ||
| // Track channel fill metrics for all channels | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing these since it seems they are not being used |
||
| kvFill := len(w.kvChan) | ||
| leafFill := len(w.leafChan) | ||
|
|
||
| if kvFill > w.maxKvFill { | ||
| w.maxKvFill = kvFill | ||
| } | ||
| if leafFill > w.maxLeafFill { | ||
| w.maxLeafFill = leafFill | ||
| } | ||
|
|
||
| atomic.AddInt64(&w.kvFillSum, int64(kvFill)) | ||
| atomic.AddInt64(&w.kvFillCount, 1) | ||
| atomic.AddInt64(&w.leafFillSum, int64(leafFill)) | ||
| atomic.AddInt64(&w.leafFillCount, 1) | ||
|
|
||
| // Calculate key offset BEFORE sending to KV channel | ||
| keyOffset := w.kvsOffset | ||
| keyLen := uint32(len(key)) //nolint:gosec | ||
|
|
@@ -942,13 +918,6 @@ func (w *snapshotWriter) writeLeafDirect(version uint32, keyLen uint32, keyOffse | |
|
|
||
| // writeBranch sends a branch write operation to the pipeline | ||
| func (w *snapshotWriter) writeBranch(version, size uint32, height, preTrees uint8, keyLeaf uint32, hash []byte) error { | ||
| // Track channel fill metrics | ||
| branchFill := len(w.branchChan) | ||
| if branchFill > w.maxBranchFill { | ||
| w.maxBranchFill = branchFill | ||
| } | ||
| atomic.AddInt64(&w.branchFillSum, int64(branchFill)) | ||
| atomic.AddInt64(&w.branchFillCount, 1) | ||
|
|
||
| // Make copy of hash since we're sending to another goroutine | ||
| hashCopy := make([]byte, len(hash)) | ||
|
|
||
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.
Check warning
Code scanning / CodeQL
Calling the system time Warning