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

feat: add ability to optionally disable internal HTTP send and receive spans #2802

Merged

Conversation

omgitsaheadcrab
Copy link
Contributor

@omgitsaheadcrab omgitsaheadcrab commented Aug 16, 2024

Description

This PR addresses the issue where it is not possible to disable internal HTTP send and receive spans. For many members of the community these do not provide any value and only add noise to the traces. Other mechanisms of filtering them out, such as wrapping span processors or exporters are clunky.

Providing arguments that allow users to disable one or both of these would be of great benefit.

Fixes #831 and addresses user comments in the now closed PR #815

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

  • TestAsgiApplication.test_exclude_internal_spans added to test logic
  • Integration tests performed manually using fastapi and configuring the instrumentor.

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • 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 Aug 16, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@omgitsaheadcrab omgitsaheadcrab marked this pull request as draft August 16, 2024 12:34
@omgitsaheadcrab omgitsaheadcrab marked this pull request as ready for review August 16, 2024 12:37
@omgitsaheadcrab omgitsaheadcrab requested a review from a team August 16, 2024 13:00
@omgitsaheadcrab omgitsaheadcrab requested review from lzchen and xrmx August 19, 2024 20:17
@omgitsaheadcrab omgitsaheadcrab requested a review from lzchen August 21, 2024 06:32
@omgitsaheadcrab
Copy link
Contributor Author

tox -e lint didn't give the same result as tox -elint-instrumentation-asgi.. I've refactored it by extracting the send_span and server_span logic to helpers rather than just disabling the pylint rule. Looks cleaner now too.

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.

Next time please better shut up pylint warnings on methods size and do the separation in helpers separately to ease review

@omgitsaheadcrab omgitsaheadcrab requested a review from xrmx August 23, 2024 08:38
@omgitsaheadcrab omgitsaheadcrab requested a review from xrmx August 24, 2024 12:22
@lzchen
Copy link
Contributor

lzchen commented Aug 26, 2024

@omgitsaheadcrab

Changes look good to us! I think you have a few tests that are failing as a result of your changes.

@omgitsaheadcrab
Copy link
Contributor Author

Ugh! I ran it with assert locally and it worked, didn't check the self.assertTrue suggestion. I'm away from home on leave now so I'll see if I can fix whatever broke from another pc 🤔

@omgitsaheadcrab
Copy link
Contributor Author

@xrmx @lzchen I'm back from annual leave now and I've updated the test. Apologies for letting this sit so long!

@lzchen lzchen merged commit 02c9561 into open-telemetry:main Sep 10, 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.

FastApi auto-instrumentation send extra spans for a single API execution
3 participants