-
Notifications
You must be signed in to change notification settings - Fork 31
Compute sublayers for non root toplevel spans #384
Conversation
b5d51fb
to
466906c
Compare
0de20f4
to
0765f1c
Compare
Gopkg.lock
Outdated
@@ -25,7 +25,8 @@ | |||
[[projects]] |
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.
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.
Just some minor comments with regards to documentation.
model/trace.go
Outdated
@@ -122,3 +122,87 @@ func (t Trace) APITrace() *APITrace { | |||
EndTime: end, | |||
} | |||
} | |||
|
|||
// Subtrace represents the combination of a root and the trace consisting of all its descendant spans |
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.
You missed a word here.
Subtrace represents the combination of a root span and the trace consisting of all its descendant spans.
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.
✅
model/trace.go
Outdated
Trace Trace | ||
} | ||
|
||
// spaAndAncestors is an internal type used by ExtractTopLevelSubtraces |
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.
Here there is also a typo. It would be nice to explain (for devs) what this type is, in the comment, as opposed to writing that it is internal, which is obvious from the fact that it's unexported.
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.
✅
model/trace.go
Outdated
return value | ||
} | ||
|
||
// ExtractTopLevelSubtraces extracts all subtraces rooted in a toplevel span |
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.
Please add a comma at the end of this line and a period at the end of the second.
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.
✅
model/trace.go
Outdated
|
||
visited := make(map[*Span]bool, len(t)) | ||
subtracesMap := make(map[*Span][]*Span) | ||
next := stack{} |
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.
I don't feel very strongly about this but in Go it's generally nicer as:
var next stack
Which has the same outcome.
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.
That looks nicer indeed
0765f1c
to
5409140
Compare
Until now sublayers were only computed for the root span of each trace. We now compute it for all non leaf top level spans of the trace. The purpose being to fix some gaps in the data currently shown in the UI.
This is implemented by extracting all relevant subtraces in each trace and computing the sublayers for each of theses subtraces individually.
One consequence of this change is that now the complexity of computing sublayers is no longer
O(s)
withs
the number of spans, butO(s * t)
withs
the number of spans andt
the number of top level spans. Which may have a very significant performance impact on some pathological traces.It has been deployed on staging and I haven't noticed any significant change on the CPU footprint from trace-agent.