-
Notifications
You must be signed in to change notification settings - Fork 713
Description
Describe the feature
context.Cause
was added in Go 1.20, so this SDK should be able to use it. Right now this SDK simply returns the value of context.Err()
which, in case of cancellation, is always non-informative context.Canceled
.
Use Case
In my particular case, I have a concurrent data pipeline which ingests very large files from S3. If error is detected somewhere mid-pipeline, the most convenient way to cancel a very long read is to cancel the context on it (as context.CancelCauseFunc
/context.CancelFunc
are idempotent and concurrency safe).
However, I would also like to log the exact reason as to why read was aborted, and it is not helpful, that I'm getting context.Canceled
out of the reader and not a much more descriptive error I supply as a cause.
The above reasoning applies to other operations of the sort (reading/writing to S3, listening to Kinesis, anything that has to run for a long time and requires concurrent processing on the client).
Proposed Solution
Replace uses of ctx.Err()
with context.Cause(ctx)
. The replacement should be reasonably benign in most cases.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS Go SDK V2 Module Versions Used
github.com/aws/aws-sdk-go-v2 v1.36.3
github.com/aws/aws-sdk-go-v2/config v1.29.14
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30
github.com/aws/aws-sdk-go-v2/feature/rds/auth v1.5.11
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.75
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.50.0
github.com/aws/aws-sdk-go-v2/service/ec2 v1.218.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.79.3
Go version used
1.24.3