-
Notifications
You must be signed in to change notification settings - Fork 588
ref: Add warnings to span streaming APIs (10) #5613
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
Changes from all commits
946decc
f3ee55c
47ed910
5023c76
6445447
47e6211
1e7b694
80bfe5a
1f0ffc1
d773428
647fa79
49bdbe6
cdd8bd6
54f81af
941863e
4b14e8d
474f8e6
9996e29
e20d4fd
f2738ff
7874a54
63a9396
c974d3e
5d8c238
831adae
656ef2e
1dcf176
0a7eae8
6888c56
09e5cce
ae2fd52
f223574
05a4157
9e8e60e
777a246
9b1e2f3
e589c53
1487ea8
1006e7b
6c16dbf
cb37a07
ad6e7cc
ba29f0c
d6a42b2
5e20ad3
c70fae4
b995770
0235053
60217e1
b673a09
d6fa965
3602f86
9f59eb0
bd8e1c9
9b3df81
8614d52
cdee8bc
72f0968
dab1970
7daa720
b59f3cd
2f0dc01
dc81637
bc9f765
45372c1
09b88f0
a9b33a9
8a31eeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| import os | ||
| import re | ||
| import sys | ||
| import warnings | ||
| from collections.abc import Mapping, MutableMapping | ||
| from datetime import timedelta | ||
| from random import Random | ||
|
|
@@ -958,6 +959,14 @@ def span_decorator(f: "Any") -> "Any": | |
|
|
||
| @functools.wraps(f) | ||
| async def async_wrapper(*args: "Any", **kwargs: "Any") -> "Any": | ||
| client = sentry_sdk.get_client() | ||
| if not has_span_streaming_enabled(client.options): | ||
| warnings.warn( | ||
| "Using span streaming API in non-span-streaming mode. Use " | ||
| "@sentry_sdk.trace instead.", | ||
| stacklevel=2, | ||
| ) | ||
|
|
||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| span_name = name or qualname_from_function(f) or "" | ||
|
Comment on lines
+965
to
970
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Suggested FixRemove the warning check from the Prompt for AI Agent |
||
|
|
||
| with start_streaming_span( | ||
|
|
@@ -973,6 +982,14 @@ async def async_wrapper(*args: "Any", **kwargs: "Any") -> "Any": | |
|
|
||
| @functools.wraps(f) | ||
| def sync_wrapper(*args: "Any", **kwargs: "Any") -> "Any": | ||
| client = sentry_sdk.get_client() | ||
| if not has_span_streaming_enabled(client.options): | ||
| warnings.warn( | ||
| "Using span streaming API in non-span-streaming mode. Use " | ||
| "@sentry_sdk.trace instead.", | ||
| stacklevel=2, | ||
| ) | ||
|
|
||
| span_name = name or qualname_from_function(f) or "" | ||
|
|
||
| with start_streaming_span( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.