forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
131850: raft: add tracing to raft r=pav-kv a=andrewbaptist This commit adds tracing to the various places within raft where state transitions happen. When a message is first proposed, it matches the context of the original message to the raft entry and registers it for tracing. Then it adds to the trace at the key points during the transitions and finally stops tracing once a `MsgStorageApplyResp` is received past the entry. Fixes: cockroachdb#104035 Release note: None 132365: opt: refactor used indexes r=mgartner a=mgartner I noticed the unnecessary usage of strings to track index usage in some CPU/heap profiles. I attempted to eliminate this entirely, but unfortunately these strings are persisted, making modification of the type difficult, and I had difficulty following the thread from their creation all the way to their consumption - I think someone with more expertise in the observability part of the code base would be required to untangle this. So for now I've settled for refactoring the creation of "used indexes" to avoid using strings until later on during instrumentation. This has the minor benefit possible de-duplicating the indexes before generating the strings, if an index is used multiple times in a query. I've also replaced the expensive usage of `fmt.Sprintf` for generating the strings to the faster `+` concatenation (benchmarks for this are at: https://gist.github.com/mgartner/28a9d52e54e91691d0a7617164aa3157). Epic: None Release note: None Co-authored-by: Andrew Baptist <[email protected]> Co-authored-by: Marcus Gartner <[email protected]>
- Loading branch information
Showing
32 changed files
with
1,188 additions
and
118 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "rafttrace", | ||
srcs = ["rafttrace.go"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/rafttrace", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/kv/kvpb", | ||
"//pkg/kv/kvserver/kvserverpb", | ||
"//pkg/raft", | ||
"//pkg/raft/raftpb", | ||
"//pkg/settings", | ||
"//pkg/settings/cluster", | ||
"//pkg/util/log", | ||
"//pkg/util/syncutil", | ||
"//pkg/util/tracing", | ||
"//pkg/util/tracing/tracingpb", | ||
"@com_github_cockroachdb_logtags//:logtags", | ||
"@com_github_cockroachdb_redact//:redact", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "rafttrace_test", | ||
srcs = ["rafttrace_test.go"], | ||
embed = [":rafttrace"], | ||
deps = [ | ||
"//pkg/kv/kvpb", | ||
"//pkg/kv/kvserver/kvserverpb", | ||
"//pkg/raft/raftpb", | ||
"//pkg/settings/cluster", | ||
"//pkg/testutils", | ||
"//pkg/util/tracing", | ||
"//pkg/util/tracing/tracingpb", | ||
"@com_github_stretchr_testify//require", | ||
], | ||
) |
Oops, something went wrong.