Skip to content

api: conditionally load entrypoints for OTEL_PYTHON_CONTEXT#5144

Open
codeboten wants to merge 4 commits intoopen-telemetry:mainfrom
codeboten:codeboten/load-context-api
Open

api: conditionally load entrypoints for OTEL_PYTHON_CONTEXT#5144
codeboten wants to merge 4 commits intoopen-telemetry:mainfrom
codeboten:codeboten/load-context-api

Conversation

@codeboten
Copy link
Copy Markdown
Contributor

@codeboten codeboten commented Apr 24, 2026

Description

This prevents unnecessarily importing the entry points library, reducing the memory footprint of loading the API by about a MB (27%):

Scenario Memory before Memory after delta
Import API only 5.43 MB 4.49 MB -940 KB
API + get_tracer (no-op) 5.05 MB 4.10 MB -950 KB

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

  • Ran unit tests locallt

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

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

This prevents unnecessarily importing the entry points library, reducing
the memory footprint of loading the API by about a MB (27%):

|Scenario | Memory before | Memory after | delta |
| - | - | - | - |
|Import API only | 5.43 MB | 4.49 MB | -940 KB |
|API + get_tracer (no-op) | 5.05 MB | 4.10 MB | -950 KB |

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
@codeboten codeboten requested a review from a team as a code owner April 24, 2026 20:43
@codeboten codeboten marked this pull request as draft April 24, 2026 20:43
Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @codeboten. Please add a changelog entry 👍🏻

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
@codeboten codeboten marked this pull request as ready for review April 27, 2026 16:49
@codeboten
Copy link
Copy Markdown
Contributor Author

added changelog, ptal

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants