feat(metrics): Add Dgraph txn metrics (commits and discards).#7339
Merged
karlmcguire merged 13 commits intomasterfrom Jan 25, 2021
Merged
feat(metrics): Add Dgraph txn metrics (commits and discards).#7339karlmcguire merged 13 commits intomasterfrom
karlmcguire merged 13 commits intomasterfrom
Conversation
When the method tag is exported it's possible to get split metrics like
the following:
dgraph_txn_aborts_total{method="",status=""} 2
dgraph_txn_aborts_total{method="Server.Mutate",status=""} 1
dgraph_txn_commits_total{method="",status=""} 3
dgraph_txn_commits_total{method="Server.Mutate",status=""} 13
dgraph_txn_discards_total{method="",status=""} 1
When setting "CommitNow" in a mutation, the txn commit and abort metrics
are tracked under method="Server.Mutate". When the mutate and commit are
separate calls, the metric is recorded under method="".
This is confusing. It's clearer to bucket these metrics together, so for
the dgraph_txn metrics we don't set those tags in the stats view.
|
Deploy preview for dgraph-docs ready! Built with commit 71222ad |
manishrjain
approved these changes
Jan 25, 2021
Contributor
manishrjain
left a comment
There was a problem hiding this comment.
Reviewed 1 of 3 files at r8, 3 of 3 files at r10, 1 of 1 files at r11.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @danielmai and @vvbalaji-dgraph)
worker/draft.go, line 1770 at r11 (raw file):
func (n *node) monitorRaftMetrics() { ticker := time.NewTicker(5 * time.Second)
revert.
x/metrics.go, line 293 at r11 (raw file):
TagKeys: allTagKeys, }, // Raft metrics
the comment is not aligned.
danielmai
added a commit
that referenced
this pull request
Jan 25, 2021
#7365) This PR is a follow-up to #7339 to update the way dgraph_txn_discards_total and dgraph_txn_aborts_total are tracked. When the client calls Discard, only the dgraph_txn_discards_total metric is incremented, not dgraph_txn_aborts_total. This makes it easy to see: 1. If the client is calling Discard 2. If the server is aborting transactions (e.g., because of transaction conflicts) Additional changes: * Update metrics description text
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.
In #6171 the metric to track txn aborts was added. This PR adds metrics for txn commits and txn discards:
dgraph_txn_commits_totaldgraph_txn_discards_totaldgraph_txn_commits_totalis incremented on successful commits.dgraph_txn_discards_totalis incremented when the client calls txn.Discard.Calling txn.Discard is also considered a txn abort, soAs of #7365dgraph_txn_aborts_totalis also incremented (that's already the behavior even before this change).dgraph_txn_discards_totaltracks the number of client-called Discard calls.dgraph_txn_aborts_totaltracks the number of txn aborts made by the server.Changes to dgraph_txn metrics (including the existing
dgraph_txn_aborts_totalmetric):When the method tag is exported it's possible to get split metrics like
the following:
When setting "CommitNow" in a mutation, the txn commit and abort metrics
are tracked under method="Server.Mutate". When the mutate and commit are
separate calls, the metric is recorded under method="".
This is confusing. It's clearer to bucket these metrics together, so for
the dgraph_txn metrics we don't set those tags in the stats view:
Fixes DGRAPH-1137
This change is