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

instrumentation/fastapi: fix fastapi-slim support #2756

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

xrmx
Copy link
Contributor

@xrmx xrmx commented Jul 30, 2024

Description

In instrumentation_dependencies we need to use importlib.metadata.distribution because find_spec("fastapi") will return something even with just fastapi-slim installed.

Then need to fix the tox environment name otherwise all the fastapi dependencies will also be installed for fastapi-slim and tests would pass because they find fastapi installed.

Fixes #2683

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

  • Test A

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

@xrmx xrmx requested a review from a team July 30, 2024 19:40
@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jul 30, 2024
@xrmx xrmx marked this pull request as draft July 30, 2024 19:40
@xrmx xrmx force-pushed the fix-fastapi-slim-handling branch from 6f0fa1a to 96e6cc9 Compare July 30, 2024 19:45
@xrmx xrmx removed the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jul 30, 2024
@xrmx xrmx force-pushed the fix-fastapi-slim-handling branch from 96e6cc9 to 2af7311 Compare July 31, 2024 09:43
@xrmx xrmx marked this pull request as ready for review July 31, 2024 09:43
@xrmx xrmx force-pushed the fix-fastapi-slim-handling branch from 2af7311 to 5febb55 Compare July 31, 2024 09:44
xrmx added 3 commits August 1, 2024 11:31
In instrumentation_dependencies we need to use pkg_resources.get_distribution
because find_spec("fastapi") will return something even with just fastapi-slim
installed.

Then need to fix the tox environment name otherwise all the fastapi
dependencies will also be installed for fastapi-slim and tests would
pass because they find fastapi installed.
@xrmx xrmx force-pushed the fix-fastapi-slim-handling branch from d42b9bf to c454847 Compare August 1, 2024 09:31
@xrmx xrmx requested a review from lzchen August 1, 2024 12:15
@lzchen lzchen merged commit 32e6f6d into open-telemetry:main Aug 1, 2024
389 checks passed
@emdneto
Copy link
Member

emdneto commented Aug 1, 2024

It seems the tests for fastapislim aren't being run in CI. Checked the job and is only installing the packages 😓

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-slim support
3 participants