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

transport/http: fix metrics race condition #555

Merged
merged 4 commits into from
Jan 21, 2025

Conversation

rjeczalik
Copy link
Contributor

This PR fixes a race condition reported by #548,
by introducing a simple wrapper for time.Time.

While by default aws-sdk-go-v2 uses NopMeterProvider, the transport/http internals are still instrumenting the http requests (the withMetrics func).

Maybe there is a room for improvement, to not call httptrace.WithClientTrace when the meter is nop,
however this is out of scope for this PR.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rjeczalik rjeczalik requested review from a team as code owners December 9, 2024 08:36
@rjeczalik
Copy link
Contributor Author

fyi @lucix-aws @Madrigal

@rjeczalik
Copy link
Contributor Author

gentle ping

@lucix-aws
Copy link
Contributor

This looks fine - please create a changelog entry - see https://github.com/aws/aws-sdk-go-v2/blob/main/CONTRIBUTING.md#changelog-documents (it's the SDK repo, but the process is the same).

@lucix-aws
Copy link
Contributor

closes #548
closes aws/aws-sdk-go-v2#2907

@lucix-aws
Copy link
Contributor

I added instructions / the make recipe to this repo as well: https://github.com/aws/smithy-go/blob/main/CONTRIBUTING.md#changelog-documents

This PR fixes a race condition reported by aws#548,
by introducing a simple wrapper for time.Time.

While by default aws-sdk-go-v2 uses NopMeterProvider,
the transport/http internals are still instrumenting
the http requests (the withMetrics func).

Maybe there is a room for improvement, to not call
httptrace.WithClientTrace when the meter is nop,
however this is out of scope for this PR.
@rjeczalik
Copy link
Contributor Author

@lucix-aws done

@lucix-aws lucix-aws merged commit ee8334e into aws:main Jan 21, 2025
11 checks passed
@rjeczalik rjeczalik deleted the time-race-fix branch January 21, 2025 18:00
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.

smithy-go data race in latest release of aws-sdk-go-v2 Smithy-go's HTTP metrics are prone to data races
2 participants