Skip to content

Conversation

@deepakdinesh1123
Copy link

Description

Added the enviornment variable OTEL_PYTHON_FASTAPI_EXCLUDE_SPANS to support excluding the send and receive spans that the ASGI middleware generates.

Fixes #3992

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?

  • Disable send spans and check that send spans are ignored
  • Disable receive spans and check that receive spans are ignore
  • Disable both send and receive spans and check that both are ignored
  • Exception raised when invalid values are passed to environment variable
  • Check that exclude_spans argument takes priority over the environment variable

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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 7, 2025

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: deepakdinesh1123 / name: deepakdinesh1123 (f672f37)

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.

Add environment variable for exclude_spans parameter in FastAPI/ASGI instrumentation

1 participant