-
Notifications
You must be signed in to change notification settings - Fork 721
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
opentelemetry: slightly improve OpentemetrySubscriber
's performance by pre-determined the attribute length
#1327
Conversation
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.
Overall this looks great, I had a couple little suggestions.
Would be nice to get @jtescher's eyes on this as well.
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.
Agree with @hawkw's comments, other than that looks good to me
1d36313
to
97689bf
Compare
97689bf
to
c812e42
Compare
## Motivation Exposing an accessor for the `FieldSet` on `Attributes` can motivate the subscriber to achieve some performance improvement, such as `OpenTelemetrySubscriber` #1327. ## Alternative Make `ValueSet::field_set()` be `pub` instead of `pub(crate)`. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
c812e42
to
13b31c2
Compare
## Motivation Exposing an accessor for the `FieldSet` on `Attributes` can motivate the subscriber to achieve some performance improvement, such as `OpenTelemetrySubscriber` #1327. ## Alternative Make `ValueSet::field_set()` be `pub` instead of `pub(crate)`. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
## Motivation Exposing an accessor for the `FieldSet` on `Attributes` can motivate the subscriber to achieve some performance improvement, such as `OpenTelemetrySubscriber` #1327. ## Alternative Make `ValueSet::field_set()` be `pub` instead of `pub(crate)`. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
## Motivation Exposing an accessor for the `FieldSet` on `Attributes` can motivate the subscriber to achieve some performance improvement, such as `OpenTelemetrySubscriber` #1327. ## Alternative Make `ValueSet::field_set()` be `pub` instead of `pub(crate)`. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
## Motivation Exposing an accessor for the `FieldSet` on `Attributes` can motivate the subscriber to achieve some performance improvement, such as `OpenTelemetrySubscriber` #1327. ## Alternative Make `ValueSet::field_set()` be `pub` instead of `pub(crate)`. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
## Motivation Exposing an accessor for the `FieldSet` on `Attributes` can motivate the subscriber to achieve some performance improvement, such as `OpenTelemetrySubscriber` #1327. ## Alternative Make `ValueSet::field_set()` be `pub` instead of `pub(crate)`. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
… by pre-determined the attribute length
13b31c2
to
5782fd2
Compare
I think we can merge this? 🚀 |
#1327) The `SpanBuilder` uses `Vec` to store span's fields. However, the current solution can be slightly improved by preparing the capacity of `Vec` in advance, this can reduce a few memory reallocations. Since the max number of tracing's span fields is 32, we can replace `Vec` with `SmallVec` to further improve performance. Maybe, we should add a new feature (such as `smallvec`?) to the `opentelemetry` crate. Well, this should be discussed in the `opentelemetry` repo. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
#1327) The `SpanBuilder` uses `Vec` to store span's fields. However, the current solution can be slightly improved by preparing the capacity of `Vec` in advance, this can reduce a few memory reallocations. Since the max number of tracing's span fields is 32, we can replace `Vec` with `SmallVec` to further improve performance. Maybe, we should add a new feature (such as `smallvec`?) to the `opentelemetry` crate. Well, this should be discussed in the `opentelemetry` repo. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
# 0.14.0 (July 9, 2021) ### Breaking Changes - Upgrade to `v0.15.0` of `opentelemetry` ([#1441]) For list of breaking changes in OpenTelemetry, see the [v0.14.0 changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/CHANGELOG.md#v0140). ### Added - Spans now include Opentelemetry `code.namespace`, `code.filepath`, and `code.lineno` attributes ([#1411]) ### Changed - Improve performance by pre-allocating attribute `Vec`s ([#1327]) Thanks to @Drevoed, @lilymara-onesignal, and @Folyd for contributing to this release!
# 0.14.0 (July 9, 2021) ### Breaking Changes - Upgrade to `v0.15.0` of `opentelemetry` ([#1441]) For list of breaking changes in OpenTelemetry, see the [v0.14.0 changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/CHANGELOG.md#v0140). ### Added - Spans now include Opentelemetry `code.namespace`, `code.filepath`, and `code.lineno` attributes ([#1411]) ### Changed - Improve performance by pre-allocating attribute `Vec`s ([#1327]) Thanks to @Drevoed, @lilymara-onesignal, and @Folyd for contributing to this release! Closes #1462
tokio-rs#1327) The `SpanBuilder` uses `Vec` to store span's fields. However, the current solution can be slightly improved by preparing the capacity of `Vec` in advance, this can reduce a few memory reallocations. Since the max number of tracing's span fields is 32, we can replace `Vec` with `SmallVec` to further improve performance. Maybe, we should add a new feature (such as `smallvec`?) to the `opentelemetry` crate. Well, this should be discussed in the `opentelemetry` repo. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
# 0.14.0 (July 9, 2021) ### Breaking Changes - Upgrade to `v0.15.0` of `opentelemetry` ([tokio-rs#1441]) For list of breaking changes in OpenTelemetry, see the [v0.14.0 changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/CHANGELOG.md#v0140). ### Added - Spans now include Opentelemetry `code.namespace`, `code.filepath`, and `code.lineno` attributes ([tokio-rs#1411]) ### Changed - Improve performance by pre-allocating attribute `Vec`s ([tokio-rs#1327]) Thanks to @Drevoed, @lilymara-onesignal, and @Folyd for contributing to this release! Closes tokio-rs#1462
The
SpanBuilder
usesVec
to store span's fields. However, the current solutioncan be slightly improved by preparing the capacity of
Vec
in advance, this can reducea few memory reallocations.
Since the max number of tracing's span fields is 32, we can replace
Vec
withSmallVec
tofurther improve performance. Maybe, we should add a new feature
(such as
smallvec
?) to theopentelemetry
crate. Well, this should be discussed in theopentelemetry
repo.