Skip to content
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

feat: using Cow<'static, str> for instrumentation library. #670

Merged
merged 3 commits into from
Nov 18, 2021

Conversation

TommyCpp
Copy link
Contributor

It allows users to pass in a String if needed, although it will have a performance overhead because we need to clone the string every time a span gets exported. I did a quick test and it seems the overhead is manageable. Less than 10%

Users that pass a 'static str will not be impacted as Cow::Borrow just copies the pointer.

Fix #666

It allows users to pass in a `String` if needed, although it will have a performance overhead because we need to clone the string everytime a span gets exported.

User that pass a `'static str` will not be impacted as `Cow::Borrow` just copies the pointer.
@TommyCpp TommyCpp requested a review from a team as a code owner November 17, 2021 03:24
@codecov
Copy link

codecov bot commented Nov 17, 2021

Codecov Report

Merging #670 (1f632f7) into main (f6f69c4) will decrease coverage by 0.02%.
The diff coverage is 70.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #670      +/-   ##
==========================================
- Coverage   63.43%   63.41%   -0.03%     
==========================================
  Files          95       95              
  Lines        7784     7796      +12     
==========================================
+ Hits         4938     4944       +6     
- Misses       2846     2852       +6     
Impacted Files Coverage Δ
opentelemetry/src/global/trace.rs 17.72% <0.00%> (-2.45%) ⬇️
opentelemetry-datadog/src/exporter/model/v05.rs 90.56% <66.66%> (-1.60%) ⬇️
opentelemetry/src/metrics/config.rs 50.00% <66.66%> (+5.17%) ⬆️
opentelemetry/src/sdk/trace/provider.rs 83.22% <75.00%> (+0.21%) ⬆️
opentelemetry/src/metrics/descriptor.rs 60.37% <80.00%> (+1.55%) ⬆️
opentelemetry-datadog/src/exporter/model/v03.rs 91.66% <100.00%> (ø)
opentelemetry-zipkin/src/exporter/model/mod.rs 82.53% <100.00%> (+0.87%) ⬆️
opentelemetry/src/metrics/meter.rs 100.00% <100.00%> (ø)
opentelemetry/src/sdk/instrumentation.rs 100.00% <100.00%> (ø)
opentelemetry/src/sdk/trace/span.rs 95.57% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6f69c4...1f632f7. Read the comment docs.

Copy link
Member

@jtescher jtescher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@TommyCpp TommyCpp merged commit 3dec604 into open-telemetry:main Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

global::tracer dynamic naming
2 participants