Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for unwrapping wrapped ReadProjectionConfig instances and notifying when a fast open read is claimed. This is done by adding unwrap() and onFastOpenReadClaimed() methods to ReadProjectionConfig, implementing them in OtelStorageDecorator, and integrating them into ObjectReadSessionImpl. A test case has been added to verify this behavior. The review feedback suggests that the test's WrappedConfig helper class should recursively call delegate.unwrap() instead of returning delegate directly, ensuring consistency and robustness in case of nested wrapping.
| @Override | ||
| ReadProjectionConfig<ApiFuture<byte[]>> unwrap() { | ||
| return delegate; | ||
| } |
There was a problem hiding this comment.
For robustness and consistency with OtelStorageDecorator, unwrap() should recursively call delegate.unwrap() instead of returning delegate directly. This ensures that if the delegate itself is wrapped, it will be correctly unwrapped to the base config.
| @Override | |
| ReadProjectionConfig<ApiFuture<byte[]>> unwrap() { | |
| return delegate; | |
| } | |
| @Override | |
| ReadProjectionConfig<ApiFuture<byte[]>> unwrap() { | |
| return delegate.unwrap(); | |
| } |
Sixth step of fast open BiDi reads (go/fast-open-bidi-read, b/552263062). With OpenTelemetry tracing on, readAs wraps the config in OtelReadProjectionConfig, so it never equals the fast open config and the fast open read is never handed out. ReadProjectionConfig gets two package-private hooks: unwrap(), which a wrapper uses to return the config it wraps, and onFastOpenReadClaimed(), which is called with the projection when readAs is served from the fast open read. ObjectReadSessionImpl looks up the fast open read with config.unwrap(). OtelReadProjectionConfig unwraps to its delegate. On a hit it ends its readAs span when the read finishes, recording the error if the read fails; for a channel it ends the span right away.
3108ca7 to
dedf4d1
Compare
6/n of fast open BiDi reads
With OpenTelemetry tracing on, readAs wraps the config in OtelReadProjectionConfig, so it never equals the fast open config and the fast open read is never handed out.
ReadProjectionConfig gets two package-private hooks: unwrap(), which a wrapper uses to return the config it wraps, and onFastOpenReadClaimed(), which is called when readAs is served from the fast open read. ObjectReadSessionImpl looks up the fast open read with config.unwrap(). OtelReadProjectionConfig unwraps to its delegate and ends its readAs span on a hit, because the bytes were already requested with the open.