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(storage): single span for ReadObject() #14435

Conversation

coryan
Copy link
Member

@coryan coryan commented Jul 3, 2024

Keep the span created for ReadObject() open until the download
completes or is interrupted. This also groups resumed downloads and
backoff spans under one umbrella.

Fixes #11393


This change is Reviewable

Keep the span created for `ReadObject()` open until the download
completes or is interrupted. This also groups resumed downloads and
backoff spans under one umbrella.
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 3, 2024
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.59%. Comparing base (f51fccc) to head (0012b43).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #14435    +/-   ##
========================================
  Coverage   93.59%   93.59%            
========================================
  Files        2313     2315     +2     
  Lines      206951   207118   +167     
========================================
+ Hits       193686   193850   +164     
- Misses      13265    13268     +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coryan coryan marked this pull request as ready for review July 3, 2024 21:44
@coryan coryan requested review from a team as code owners July 3, 2024 21:44
Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @coryan)

@coryan coryan merged commit d43e267 into googleapis:main Jul 8, 2024
64 checks passed
@coryan coryan deleted the feat-storage-single-span-for-resumed-downloads branch July 8, 2024 15:54
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/**
*
Copy link
Member

Choose a reason for hiding this comment

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

?

EXPECT_CALL(*mock, Read)
.WillOnce([root] {
EXPECT_TRUE(ThereIsAnActiveSpan());
EXPECT_EQ(opentelemetry::trace::Tracer::GetCurrentSpan()->GetContext(),
Copy link
Member

Choose a reason for hiding this comment

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

nit: this was common enough to warrant a matcher.

EXPECT_THAT(root, IsActive());

Here and below.

}

bool TracingObjectReadSource::IsOpen() const {
auto scope = opentelemetry::trace::Scope(span_);
Copy link
Member

Choose a reason for hiding this comment

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

comment: this is probably good practice in case we add any instrumentation to lower layers. But just an FYI: that creating a scope does a heap allocation, so it is relatively expensive.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is that true even of Noop spans?

Copy link
Member

Choose a reason for hiding this comment

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

Is that true even of Noop spans?

Yes. They do not check whether it is a valid span before pushing to the context stack (and creating a token to track it).

https://github.com/open-telemetry/opentelemetry-cpp/blob/6dbfdb52ebca82d8705392fe88dadd9c133374e4/api/include/opentelemetry/trace/scope.h#L32-L35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OTel tracing decorator to storage::ReadObjectSource
3 participants