Skip to content

ref: Move consts, utils from integrations/opentelemetry/ #4272

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 29 commits into from
Apr 14, 2025

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Apr 10, 2025

Moving stuff out of integrations/opentelemetry/ step by step since there is no OpenTelemetry integration anymore -- it's part of the core SDK. This moves sentry_sdk/integrations/opentelemetry/{utils,consts}.py -> sentry_sdk/opentelemetry/{utils,consts}.py.

There's quite some stuff moving around in this PR in order to remove circular dependencies that have to do with tracing.py:

  • get_span_status_from_http_code from tracing.py is now in tracing_utils.py
  • various constants from tracing.py are now in consts.py

Additionally, Sphinx was unhappy, so tweaked the way we type some things in api.py and _init_implementation.py.

I'll possibly follow this up with creating a nice structure for the tracing files, maybe a common tracing directory with tracing.py, tracing_utils.py -> utils.py, and dedicated consts.py.

Ref #3853

@sentrivana sentrivana changed the base branch from potel-base to ivana/potel/move-context-sync April 10, 2025 10:35
Copy link

codecov bot commented Apr 10, 2025

Codecov Report

Attention: Patch coverage is 87.95181% with 10 lines in your changes missing coverage. Please review.

Project coverage is 83.54%. Comparing base (97f1dc9) to head (a209812).
Report is 1 commits behind head on potel-base.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/tracing_utils.py 62.96% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##           potel-base    #4272      +/-   ##
==============================================
- Coverage       83.55%   83.54%   -0.01%     
==============================================
  Files             144      144              
  Lines           14663    14631      -32     
  Branches         2325     2325              
==============================================
- Hits            12251    12223      -28     
+ Misses           1694     1690       -4     
  Partials          718      718              
Files with missing lines Coverage Δ
sentry_sdk/_init_implementation.py 100.00% <100.00%> (ø)
sentry_sdk/api.py 94.25% <ø> (ø)
sentry_sdk/consts.py 99.54% <100.00%> (+0.03%) ⬆️
sentry_sdk/integrations/aiohttp.py 86.48% <100.00%> (-0.08%) ⬇️
sentry_sdk/integrations/asgi.py 91.94% <100.00%> (-0.06%) ⬇️
sentry_sdk/integrations/bottle.py 89.32% <100.00%> (ø)
sentry_sdk/integrations/celery/__init__.py 91.02% <100.00%> (ø)
sentry_sdk/integrations/django/__init__.py 84.50% <100.00%> (-0.05%) ⬇️
sentry_sdk/integrations/falcon.py 91.30% <100.00%> (ø)
sentry_sdk/integrations/fastapi.py 89.15% <100.00%> (ø)
... and 18 more


tracer = otel_trace.get_tracer(__name__)


def get_span_status_from_http_code(http_status_code):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now in tracing_utils.py

@sentrivana sentrivana marked this pull request as ready for review April 10, 2025 12:15
@sentrivana sentrivana requested a review from a team as a code owner April 10, 2025 12:15
@sentrivana sentrivana requested review from a team and removed request for a team April 10, 2025 12:17
Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

Mostly looks good, have some questions though

Base automatically changed from ivana/potel/move-context-sync to potel-base April 10, 2025 14:27
@sentrivana sentrivana merged commit 759ded9 into potel-base Apr 14, 2025
18 checks passed
@sentrivana sentrivana deleted the ivana/potel/move-more-otel-stuff branch April 14, 2025 08:51
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants