Skip to content

Commit a58b2e6

Browse files
committed
feat(argv): Support span streaming
1 parent fb587da commit a58b2e6

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

sentry_sdk/traces.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
sentry_sdk.init(_experiments={"trace_lifecycle": "stream"}).
88
"""
99

10+
import sys
1011
import uuid
1112
import warnings
1213
from datetime import datetime, timedelta, timezone
@@ -306,6 +307,8 @@ def __init__(
306307
self._start_profile()
307308
self._set_profile_id(get_profiler_id())
308309

310+
self._set_segment_attributes()
311+
309312
self._start()
310313

311314
def __repr__(self) -> str:
@@ -564,6 +567,12 @@ def _start_profile(self) -> None:
564567

565568
self._continuous_profile = try_profile_lifecycle_trace_start()
566569

570+
def _set_segment_attributes(self) -> None:
571+
if not self._is_segment():
572+
return
573+
574+
self.set_attribute("process.command_args", sys.argv)
575+
567576

568577
class NoOpStreamedSpan(StreamedSpan):
569578
__slots__ = (

tests/tracing/test_span_streaming.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,7 @@ def test_default_attributes(sentry_init, capture_envelopes):
15331533
assert item.payload.json["items"][0]["attributes"] == {
15341534
"thread.id": {"value": mock.ANY, "type": "string"},
15351535
"thread.name": {"value": "MainThread", "type": "string"},
1536+
"process.command_args": {"value": mock.ANY, "type": "array"},
15361537
"sentry.segment.id": {"value": mock.ANY, "type": "string"},
15371538
"sentry.segment.name": {"value": "test", "type": "string"},
15381539
"sentry.sdk.name": {"value": "sentry.python", "type": "string"},

0 commit comments

Comments
 (0)