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

Fix scope leak in aws sdk instrumentation #13129

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Jan 30, 2025

Resolves #13124
When exception is thrown during marshalling we end up leaking the scope. This PR moves opening the scope after marshalling as it was before #8405

@laurit laurit requested a review from a team as a code owner January 30, 2025 13:50
@@ -233,6 +231,25 @@ public SdkRequest modifyRequest(
return request;
}

@Override
public void afterMarshalling(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I know scope is used to suppress nested http client spans. It is possible that setting up the scope in some other (later) phase would also work.

Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

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

Thanks for jumping on this so quickly, appreciate that! I think this approach makes sense -- we don't ever start a scope until the request has been marshaled, so we avoid this leak now.

I suppose one downside is that we can't even create an error span to let a user know that their request wasn't marshaled correctly. I think that's a reasonable compromise, and it seems to be aligned with the design of the AWS interceptors anyway.

@trask trask merged commit e65366b into open-telemetry:main Jan 30, 2025
58 checks passed
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.

AWS v2 instrumentation leaks scope
3 participants