-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
util/tracing: optimize span tags and expand their collection #70993
Conversation
pkg/util/tracing/tracer.go
Outdated
@@ -520,6 +520,10 @@ func (t *Tracer) startSpanGeneric( | |||
helper.crdbSpan.mu.operation = opName | |||
helper.crdbSpan.mu.recording.logs = newSizeLimitedBuffer(maxLogBytesPerSpan) | |||
helper.crdbSpan.mu.recording.structured = newSizeLimitedBuffer(maxStructuredBytesPerSpan) | |||
helper.crdbSpan.mu.tags = helper.crdbSpan.mu.tagsAlloc[:0] |
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.
Instead of this tagsAlloc
guy sitting on crdbSpanMu
, you could just have it as part of the helper
struct above, right?
This patch makes the collection of span tags generally allocation-free by storing the tags into memory pre-allocated in the span. In tandem with a previous commit which moved away from a generic (interface{}) interface for Span.SetTag(), this makes span collection very cheap. As such, this patch also re-enables the collection of tags for non-verbose (but also not no-op) spans. The collecting of tags on non-verbose spans was stopped in eba03c4 because of these allocations, as well as the allocations performed by the variadic WithTags option for StartSpan(). I'm not re-introducing WithTags. The motivation for this change is that I want to make broader use of the open spans registry, and I want (non-verbose) spans in the registry to have their tags available for inspection. I'm also planning of introducing new tags for static info defining a span (e.g. the SQL query for spans representing query execution). Note that tags in non-verbose spans continue to not be included in Recordings (and hence not serialized-deserialized over the network). This was the case, and the patch does not change it. I've run BenchmarkTracing and it shows no change. Release note: None
d5d82bf
to
a6c3d2c
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @aayushshah15 and @irfansharif)
pkg/util/tracing/tracer.go, line 523 at r1 (raw file):
Previously, irfansharif (irfan sharif) wrote…
Instead of this
tagsAlloc
guy sitting oncrdbSpanMu
, you could just have it as part of thehelper
struct above, right?
Yeah. I had oscillated about where to put it since I'm not sure how it'll end up looking when I start pooling the spans, but yeah for now at least I've moved it like you said.
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.
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @aayushshah15 and @irfansharif)
Build failed (retrying...): |
Build succeeded: |
This patch makes the collection of span tags generally allocation-free
by storing the tags into memory pre-allocated in the span. In tandem
with a previous commit which moved away from a generic (interface{})
interface for Span.SetTag(), this makes span collection very cheap. As
such, this patch also re-enables the collection of tags for
non-verbose (but also not no-op) spans. The collecting of tags on
non-verbose spans was stopped in
eba03c4 because of these allocations,
as well as the allocations performed by the variadic WithTags option
for StartSpan(). I'm not re-introducing WithTags.
The motivation for this change is that I want to make broader use of the
open spans registry, and I want (non-verbose) spans in the registry to
have their tags available for inspection. I'm also planning of
introducing new tags for static info defining a span (e.g. the SQL query
for spans representing query execution).
Note that tags in non-verbose spans continue to not be included in
Recordings (and hence not serialized-deserialized over the network).
This was the case, and the patch does not change it.
I've run BenchmarkTracing and it shows no change.
Release note: None