Skip to content

Commit c8c9c66

Browse files
committed
Merge branch 'master' into shellmayr/feat/langchain-integration-update
2 parents 6c0d172 + 1804955 commit c8c9c66

File tree

24 files changed

+1133
-346
lines changed

24 files changed

+1133
-346
lines changed

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Enriching Events
3737
Performance Monitoring
3838
======================
3939

40+
.. autofunction:: sentry_sdk.api.trace
4041
.. autofunction:: sentry_sdk.api.continue_trace
4142
.. autofunction:: sentry_sdk.api.get_current_span
4243
.. autofunction:: sentry_sdk.api.start_span

scripts/populate_tox/tox.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ deps =
300300
{py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-redis: pytest-asyncio
301301
redis-v3: redis~=3.0
302302
redis-v4: redis~=4.0
303+
redis-v4: fakeredis<2.31.0
303304
redis-v5: redis~=5.0
304305
redis-latest: redis
305306

sentry_sdk/ai/utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from sentry_sdk.utils import logger
88

99

10-
def _normalize_data(data):
11-
# type: (Any) -> Any
10+
def _normalize_data(data, unpack=True):
11+
# type: (Any, bool) -> Any
1212

1313
# convert pydantic data (e.g. OpenAI v1+) to json compatible format
1414
if hasattr(data, "model_dump"):
@@ -18,18 +18,18 @@ def _normalize_data(data):
1818
logger.warning("Could not convert pydantic data to JSON: %s", e)
1919
return data
2020
if isinstance(data, list):
21-
if len(data) == 1:
22-
return _normalize_data(data[0]) # remove empty dimensions
23-
return list(_normalize_data(x) for x in data)
21+
if unpack and len(data) == 1:
22+
return _normalize_data(data[0], unpack=unpack) # remove empty dimensions
23+
return list(_normalize_data(x, unpack=unpack) for x in data)
2424
if isinstance(data, dict):
25-
return {k: _normalize_data(v) for (k, v) in data.items()}
25+
return {k: _normalize_data(v, unpack=unpack) for (k, v) in data.items()}
2626

2727
return data
2828

2929

30-
def set_data_normalized(span, key, value):
31-
# type: (Span, str, Any) -> None
32-
normalized = _normalize_data(value)
30+
def set_data_normalized(span, key, value, unpack=True):
31+
# type: (Span, str, Any, bool) -> None
32+
normalized = _normalize_data(value, unpack=unpack)
3333
if isinstance(normalized, (int, float, bool, str)):
3434
span.set_data(key, normalized)
3535
else:

sentry_sdk/consts.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ class CompressionAlgo(Enum):
100100
]
101101

102102

103+
class SPANTEMPLATE(str, Enum):
104+
DEFAULT = "default"
105+
AI_AGENT = "ai_agent"
106+
AI_TOOL = "ai_tool"
107+
AI_CHAT = "ai_chat"
108+
109+
def __str__(self):
110+
# type: () -> str
111+
return self.value
112+
113+
103114
class INSTRUMENTER:
104115
SENTRY = "sentry"
105116
OTEL = "otel"

sentry_sdk/crons/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import uuid
22

33
import sentry_sdk
4+
from sentry_sdk.utils import logger
45

56
from typing import TYPE_CHECKING
67

@@ -54,4 +55,8 @@ def capture_checkin(
5455

5556
sentry_sdk.capture_event(check_in_event)
5657

58+
logger.debug(
59+
f"[Crons] Captured check-in ({check_in_event.get('check_in_id')}): {check_in_event.get('monitor_slug')} -> {check_in_event.get('status')}"
60+
)
61+
5762
return check_in_event["check_in_id"]

0 commit comments

Comments
 (0)