Skip to content

Conversation

sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Jun 10, 2024

Contains:

Simple test

import sentry_sdk
from time import sleep

sentry_sdk.init(
    debug=True,
    traces_sample_rate=1.0,
    _experiments={"otel_powered_performance": True},
)

with sentry_sdk.start_span(description="sentry request"):
    sleep(0.1)
    with sentry_sdk.start_span(description="sentry db"):
        sleep(0.5)
        with sentry_sdk.start_span(description="sentry redis"):
            sleep(0.2)
    with sentry_sdk.start_span(description="sentry http"):
        sleep(1)

References

Misc

In OTel, this:

with tracer.start_as_current_span("parent") as parent:
    with tracer.start_span("child1"):
        pass
    with tracer.start_span("child2"):
        pass

is equivalent to

from opentelemetry import trace, context

parent = tracer.start_span("parent")

# Creates a Context object with parent set as current span
ctx = trace.set_span_in_context(parent)

# Set as the implicit current context
token = context.attach(ctx)

# Child will automatically be a child of parent
child1 = tracer.start_span("child1")
child1.end()

# Child will automatically be a child of parent
child2 = tracer.start_span("child2")
child2.end()

# Don't forget to detach or parent will remain the parent above this call stack
context.detach(token)
parent.end()

@sl0thentr0py sl0thentr0py requested a review from sentrivana June 10, 2024 19:00
@sl0thentr0py sl0thentr0py force-pushed the potel-base branch 2 times, most recently from f7f153c to 28effd6 Compare June 11, 2024 11:43
@sl0thentr0py sl0thentr0py force-pushed the potel-base branch 2 times, most recently from 16f9341 to 951477f Compare June 25, 2024 15:16
Copy link

codecov bot commented Jun 26, 2024

Codecov Report

❌ Patch coverage is 90.44970% with 206 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.85%. Comparing base (57a3405) to head (bdca31d).
⚠️ Report is 17 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/integrations/aws_lambda.py 26.76% 52 Missing ⚠️
sentry_sdk/integrations/gcp.py 0.00% 35 Missing ⚠️
sentry_sdk/client.py 81.13% 10 Missing and 10 partials ⚠️
sentry_sdk/integrations/ray.py 43.47% 13 Missing ⚠️
sentry_sdk/integrations/asyncio.py 84.00% 6 Missing and 2 partials ⚠️
sentry_sdk/integrations/clickhouse_driver.py 84.31% 5 Missing and 3 partials ⚠️
sentry_sdk/integrations/tornado.py 82.22% 5 Missing and 3 partials ⚠️
sentry_sdk/integrations/asgi.py 89.55% 4 Missing and 3 partials ⚠️
sentry_sdk/integrations/rq.py 86.04% 2 Missing and 4 partials ⚠️
sentry_sdk/integrations/django/__init__.py 91.37% 5 Missing ⚠️
... and 26 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3152      +/-   ##
==========================================
- Coverage   84.85%   84.85%   -0.01%     
==========================================
  Files         156      158       +2     
  Lines       16110    16093      -17     
  Branches     2740     2564     -176     
==========================================
- Hits        13670    13655      -15     
+ Misses       1651     1648       -3     
- Partials      789      790       +1     
Files with missing lines Coverage Δ
sentry_sdk/__init__.py 100.00% <100.00%> (ø)
sentry_sdk/_init_implementation.py 100.00% <100.00%> (+4.16%) ⬆️
sentry_sdk/_log_batcher.py 79.76% <100.00%> (+0.24%) ⬆️
sentry_sdk/_lru_cache.py 100.00% <100.00%> (ø)
sentry_sdk/_queue.py 62.22% <100.00%> (+2.22%) ⬆️
sentry_sdk/_werkzeug.py 50.00% <100.00%> (+1.85%) ⬆️
sentry_sdk/ai/utils.py 86.95% <100.00%> (+0.59%) ⬆️
sentry_sdk/attachments.py 100.00% <100.00%> (ø)
sentry_sdk/crons/api.py 100.00% <100.00%> (ø)
sentry_sdk/crons/decorator.py 100.00% <100.00%> (ø)
... and 140 more

@sl0thentr0py sl0thentr0py changed the title Skeletons for new POTEL components New POTEL base branch Jul 9, 2024
@sl0thentr0py sl0thentr0py changed the title New POTEL base branch potel implementation base branch Jul 9, 2024
@antonpirker antonpirker changed the title potel implementation base branch POtel implementation base branch Aug 5, 2024
@sentrivana sentrivana removed their request for review August 28, 2024 09:12
getsentry-bot and others added 29 commits July 31, 2025 15:02
Merging `master` into `potel-base`, done in a PR because there have been
some changes needed to the `span.name` setter to make it work for potel.
Seems like some `before_send`s out there might assume tags without safe
access as we found out during dogfooding.
The timeout in the AWS Lambda (and GCP, by extension) timeout warning is
wrong, remove it and slightly rephrase.

This is on `potel-base` since it breaks grouping. (Even just removing
the number from the original message, without modifying it further,
causes regrouping. Since that's the case I took the liberty to update
the message a bit more.)

Fixes #4629
`exclude_span_origins` and `only_as_child_span` were missing from the
repo migration guide

And fixing some wording
Add an async span context manager to allow for cleaner nesting in async
code. Currently only delegates to the synchronous context manager.

Fixes GH-2007
* DONT USE context manager since we're doing manual span management
we need to call the original function first for `db_params` to be
correctly populated in the generator case

(see diff without whitespace)
Includes:

* this PR: new shared base class for common sync/async logic
* #4580
* #4591
* #4614
* #4615
* #4700

Fixes GH-4568

---------

Co-authored-by: Neel Shah <[email protected]>
Clarified the async transport option details in the changelog.
Update the migration guide for 3.0 to include information on the async
transport and context manager

---------

Co-authored-by: Ivana Kellyer <[email protected]>
We are moving away from Spotlight's overlay mode with its new versions
so removing this integration from the SDK too.

Ref getsentry/spotlight#891
Making the HTTP2 transport the default when `h2` and `httpcore` packages
are installed. We've been testing this on Sentry SaaS for a while
without any issues.

We should promote installing the SDK as `sentry-sdk[http2]` for this to
be picked up though. Since we still have to support Python 3.7 and `h2`
not being supported there, we cannot install it by default and use HTTP2
directly.

---------

Co-authored-by: Ivana Kellyer <[email protected]>
@antonpirker antonpirker changed the title POtel implementation base branch POtel implementation base branch (aka SDK 3.0.0) Sep 12, 2025
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.

7 participants