-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tracing: aggregate OperationMetadata on span Finish()
This change adds a `ChildrenMetadata` map to `crdbspan` that is a mapping from operation to the operations' aggregated metadata. This map is updated whenever a child of the `crdbSpan` finishes, with metadata from all spans in the finishing childs' Recording. The map is therefore a bucketed view of all the operations being traced by a span. The motivation for this change is to surface more metadata about the suboperations being traced in a spans' Recording. This could in turn provide more o11y into why a job is slow/stuck, or where the performance of a distributed operation is bottlenecked. As part of a span Finish()ing, the span fetches its Recording with the spans' configured verbosity. Prior to this change the recording would then be processed as follows: *Verbose Recording* In the case of Verbose recording the spans in the recording are added to the parents' `finishedChildren` slice provided we have not exceeded the maximum number of children a parent can track. *Structured Recording* In the case of a Structured recording, only the StructuredEvents from the spans in the recording are copied into the parent. With this change, in both the Verbose and Structured recording mode, a finishing span is also responsible for rolling up the OperationMetadata of all the spans in its recording. This involves updating the parents' `childrenMetadata` mapping with: 1) an entry for the finishing span. 2) an entry for each of the finishing spans' Finish()ed children. 3) an entry for each of the finishing spans' open children, and their children recursively The logic for 2) and 3) is subsumed in the method responsible for getting the finishing spans' recording. Notably, GetRecording(...) for both Structured and Verbose recordings, populate the root of the recording with OperationMetadata of all finished and open children in the recording. As an example when we are done finishing `child`: ``` parent child (finished_C: 4s, finished_D: 3s) open_A (finished_B: 1s) finished_B finished_C (finished_D: 3s) finished_D ``` We'd expect `parent` to have: `{child: 10s, finished_C: 4s, finished_D: 3s, open_A: 3s, finished_B: 1s}` Given that Finish()ing a child, and importing a remote recording into a span share the same code path, the above semantics also apply to a remote recording being imported into a parent span. Fixes: #80391 Release note: None
- Loading branch information
1 parent
8d34ef1
commit b31ca53
Showing
7 changed files
with
455 additions
and
36 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
Oops, something went wrong.