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(tornado): ensure reading future.result() won't throw an exception in client.py _finish_tracing_callback #2563

Merged
merged 29 commits into from
Aug 19, 2024

Conversation

jgibo
Copy link
Contributor

@jgibo jgibo commented May 29, 2024

Description

Ensures correct handling of an exception future result from tornado http client. Before this change, an exception result would cause an exception to be raised that is not handled by the lib - which is undesired based on logic in client.py _finish_tracing_callback.

Fixes #2555

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • With tornado instrumentation enabled, use tornado http client fetch with option raise_error=True and make a request that fails (response of 404, 500, etc...). An exception in _finish_tracing_callback will be raised that is not handled above - bubbles up to the asyncio runtime.
  • Unit test added to verify traced http client request failure has its span exported (indirectly verifies that _finish_tracing_callback completes successfully).
    Note: The new test class class TestTornadoHTTPClientInstrumentation can be copied to main branch, and test_http_client_failed_response will fail due to this bug.

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link

linux-foundation-easycla bot commented May 29, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@jgibo jgibo marked this pull request as ready for review May 29, 2024 06:19
@jgibo jgibo requested a review from a team May 29, 2024 06:19
@jgibo
Copy link
Contributor Author

jgibo commented May 29, 2024

This is ready for review now - not planning on making any further changes before it's reviewed.

@jgibo
Copy link
Contributor Author

jgibo commented May 29, 2024

Note: Running the lint fix commands .tox/lint/bin/black . and .tox/lint/bin/isort . applied some lint fixes to other libs (commit cbb3e4d)

Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

I would drop the commit that fixes linting outside the tornado instrumentation and possibly open a new PR with them.

@jgibo
Copy link
Contributor Author

jgibo commented May 29, 2024

I would drop the commit that fixes linting outside the tornado instrumentation and possibly open a new PR with them.

@xrmx Fixed. Reverted original lint fix commit, re-applied on only tornado dir

CHANGELOG.md Outdated Show resolved Hide resolved
@lzchen
Copy link
Contributor

lzchen commented Aug 1, 2024

@jgibo

Needs a rebase. Please also allow for maintainer editing so we can rebase for you.

@jgibo
Copy link
Contributor Author

jgibo commented Aug 2, 2024

@lzchen I've merged main in and resolved the changelog conflict, is that equivalent to what you meant by rebasing?

It looks like I can't enable maintainer edit as the fork is on a organisation account, not a personal account.

lmk how we should proceed. I'm happy to check it twice daily to keep it up-to-date if it's being prepared for merge.

CHANGELOG.md Outdated Show resolved Hide resolved
@jgibo
Copy link
Contributor Author

jgibo commented Aug 5, 2024

Merge conflict resolved, changelog entry moved to Unreleased.Fixed

@xrmx xrmx requested review from lzchen and emdneto August 5, 2024 07:31
@lzchen
Copy link
Contributor

lzchen commented Aug 12, 2024

It looks like I can't enable maintainer edit as the fork is on a organisation account, not a personal account.

Unfortunately you will have to rebase again. I'll try to address this one asap to merge in before any others.

@jgibo
Copy link
Contributor Author

jgibo commented Aug 13, 2024

@lzchen No worries. Main merged in and changelog confict resolved.

@lzchen
Copy link
Contributor

lzchen commented Aug 14, 2024

@jgibo

Seems like we are good for the reviews. Hopefully one more rebase and we should be good to go!

@jgibo
Copy link
Contributor Author

jgibo commented Aug 19, 2024

@lzchen Nice! Rebased.

@lzchen lzchen merged commit 560fd04 into open-telemetry:main Aug 19, 2024
521 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.

opentelemetry-instrumentation-tornado: Unhandled exception in _finish_tracing_callback
9 participants