-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tailsampler: Combine batches of spans into a single batch #1864
Conversation
…nstream processors may operate on the entire trace
Codecov Report
@@ Coverage Diff @@
## master #1864 +/- ##
==========================================
+ Coverage 91.23% 91.26% +0.02%
==========================================
Files 272 272
Lines 16263 16266 +3
==========================================
+ Hits 14838 14845 +7
+ Misses 998 996 -2
+ Partials 427 425 -2
Continue to review full report at Codecov.
|
} | ||
|
||
_ = tsp.nextConsumer.ConsumeTraces(policy.ctx, allSpans) |
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.
Perhaps not for this PR, but in case an error happens, would be nice to have it logged, even if at debug level.
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 we can do this in a separate pr
processor/samplingprocessor/tailsamplingprocessor/processor_test.go
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
func findTrace(a []pdata.Traces, traceID pdata.TraceID) int { |
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.
The name is a bit misleading, as it's not finding a trace, it's returning the number of traces that were found for the given ID. Suggestion: numTracesWithID()
?
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 is probably a better way to do this, but its finding the Index of the trace in the array. I added this because there isn't a guaranteed order in which the traces are received
In the case where the trace is not found it returns the size of the array which might be confusing, I could change this to -1
if you'd like.
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.
Would using t.Fatal()
or assert.Fail()
be more appropriate since it's invalid test state?
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've updated this method to return the trace or nil which makes it much clearer
processor/samplingprocessor/tailsamplingprocessor/processor_test.go
Outdated
Show resolved
Hide resolved
span.SetSpanID(tracetranslator.UInt64ToByteSpanID(uint64(i + 1))) | ||
|
||
spanID++ | ||
span.SetSpanID(tracetranslator.UInt64ToByteSpanID(uint64(spanID))) |
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.
previously this was creating duplicate span ids, now its a monotonic sequence. the other tests don't rely on the spanid it seems
Signed-off-by: Anthony J Mirabella <[email protected]>
* Update core/contrib deps to v0.58.0 * Update config source provider * Add make fmt tidy and adopt fixes * create internal/tools module for project * use wget instead of now missing curl in kafka tests Co-authored-by: Ryan Fitzpatrick <[email protected]>
Description:
Adding feature #1834
This changes the tail sampler to emit all spans for a single traces in a single batch. This allows downstream processors to easily perform operations on the entire trace.
Testing:
Added test