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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rjeczalik
Copy link

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
Author

fyi @lucix-aws @Madrigal

@rjeczalik
Copy link
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
Author

@lucix-aws done

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