Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sentry_sdk/traces.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@
sentry_sdk.init(_experiments={"trace_lifecycle": "stream"}).
"""

import sys
import uuid
import warnings
from datetime import datetime, timedelta, timezone
Expand DownExpand Up@@ -306,6 +307,8 @@ def __init__(
self._start_profile()
self._set_profile_id(get_profiler_id())

self._set_segment_attributes()

self._start()

def __repr__(self) -> str:
Expand DownExpand Up@@ -564,6 +567,12 @@ def _start_profile(self) -> None:

self._continuous_profile = try_profile_lifecycle_trace_start()

def _set_segment_attributes(self) -> None:
if not self._is_segment():
return

self.set_attribute("process.command_args", sys.argv)


class NoOpStreamedSpan(StreamedSpan):
__slots__ = (
Expand Down
1 change: 1 addition & 0 deletions tests/tracing/test_span_streaming.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -1533,6 +1533,7 @@ def test_default_attributes(sentry_init, capture_envelopes):
assert item.payload.json["items"][0]["attributes"] == {
"thread.id": {"value": mock.ANY, "type": "string"},
"thread.name": {"value": "MainThread", "type": "string"},
"process.command_args": {"value": mock.ANY, "type": "array"},
"sentry.segment.id": {"value": mock.ANY, "type": "string"},
"sentry.segment.name": {"value": "test", "type": "string"},
"sentry.sdk.name": {"value": "sentry.python", "type": "string"},
Expand Down
Loading