-
Notifications
You must be signed in to change notification settings - Fork 31
Conversation
The core model.Span is now coming from protobuf. Use gogoproto extensions to allow to keep the same JSON/msgpack fields/tags as before. To make it work, some other cleanups: - Introduce WeightedSpan to carry the "cached" topLevel and weight attributes. It makes clear that was only used in the Concentrator. - Remove some useless types or methods.
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.
Looks good. I'm wondering about the naming, but since I have no clear replacement, this can wait until we actually release this.
package model | ||
|
||
// WeightedSpan extends Span to contain weights required by the Concentrator. | ||
type WeightedSpan struct { |
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.
Wondering about the name here, it's certainly Weighted
but it also has TopLevel
. And I suspect it could have more tomorrow, as in, any information that could be inferred from trace content, but has been processed once for all & cached. Sadly I do not have a nice replacement here, ResolvedSpan
is not good too I think, because we use the Resolve
term for other things. It just itches me that Weighted
is not really about weight but "weight + other things".
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.
EnhancedSpan
perhaps?
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.
Yeah I didn't find anything better. In a way the topLevel can be seen as a boolean weight on if the stat should be computed or not ; but it might be a bit far fetch.
I'll keep it as it until we actually put something else in it.
@@ -217,7 +218,10 @@ func (a *Agent) Process(t model.Trace) { | |||
rate *= a.Receiver.preSampler.Rate() | |||
sampler.SetTraceAppliedSampleRate(root, rate) | |||
|
|||
// Need to do this computation before entering the concentrator | |||
// as they access the Metrics map, which is not thread safe. |
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.
👍 much appreciated comment.
The core
model.Span
is now coming from a protobuf model. That's to prepare the Agent to new API endpoints using protobuf. By using internally the same model, it will keep the code simple, without the need to cast to a special struct for the serialization.Use
gogoproto
extensions to allow to keep the same JSON/msgpack fields/tags as before.Comes with some cleanups, required to restructure the code:
WeightedSpan
to carry the "cached"topLevel
andweight
attributes (which are stored in theMetrics
map, but accessing it from the Concentrator while the Sampler modifies it can cause crashes). It makes clear that this extended structured is only used in the Concentrator.Results of impacted benchmarks:
Basically, no big significant changes. Some extra allocations because of the new
WeightedTrace
struct, but faster code, mostly because of references and removal of an unecessaryComputeTopLevel
. Most are actually related to the test implementation itself (which highlight that we could afford better/more isolated benchmarks).