Skip to content

Commit 69e8679

Browse files
committed
.
1 parent c42a09a commit 69e8679

3 files changed

Lines changed: 16 additions & 20 deletions

File tree

sentry_sdk/consts.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,18 @@ class SPANDATA:
11101110
Example: "python"
11111111
"""
11121112

1113+
SENTRY_SDK_NAME = "sentry.sdk.name"
1114+
"""
1115+
The name of the SDK.
1116+
Example: "python"
1117+
"""
1118+
1119+
SENTRY_SDK_VERSION = "sentry.sdk.version"
1120+
"""
1121+
The SDK version.
1122+
Example: "1.2.3"
1123+
"""
1124+
11131125
SENTRY_SDK_INTEGRATIONS = "sentry.sdk.integrations"
11141126
"""
11151127
A list of names identifying enabled integrations.

sentry_sdk/scope.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ def get_global_scope(cls) -> "Scope":
376376
def set_global_attributes(self) -> None:
377377
from sentry_sdk.client import SDK_INFO
378378

379-
self.set_attribute("sentry.sdk.name", SDK_INFO["name"])
380-
self.set_attribute("sentry.sdk.version", SDK_INFO["version"])
379+
self.set_attribute(SPANDATA.SENTRY_SDK_NAME, SDK_INFO["name"])
380+
self.set_attribute(SPANDATA.SENTRY_SDK_VERSION, SDK_INFO["version"])
381381

382382
options = sentry_sdk.get_client().options
383383

@@ -387,11 +387,11 @@ def set_global_attributes(self) -> None:
387387

388388
environment = options.get("environment")
389389
if environment:
390-
self.set_attribute("sentry.environment", environment)
390+
self.set_attribute(SPANDATA.SENTRY_ENVIRONMENT, environment)
391391

392392
release = options.get("release")
393393
if release:
394-
self.set_attribute("sentry.release", release)
394+
self.set_attribute(SPANDATA.SENTRY_RELEASE, release)
395395

396396
@classmethod
397397
def last_event_id(cls) -> "Optional[str]":

sentry_sdk/traces.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -580,22 +580,6 @@ def _set_segment_attributes(self) -> None:
580580
SPANDATA.SENTRY_SDK_INTEGRATIONS, sorted(client.integrations.keys())
581581
)
582582

583-
if (
584-
client.options.get("release")
585-
and SPANDATA.SENTRY_RELEASE not in self._attributes
586-
):
587-
self.set_attribute(
588-
SPANDATA.SENTRY_RELEASE, str(client.options["release"]).strip()
589-
)
590-
591-
if (
592-
client.options.get("environment")
593-
and SPANDATA.SENTRY_ENVIRONMENT not in self._attributes
594-
):
595-
self.set_attribute(
596-
SPANDATA.SENTRY_ENVIRONMENT, str(client.options["environment"]).strip()
597-
)
598-
599583
if client.options.get("dist") and SPANDATA.SENTRY_DIST not in self._attributes:
600584
self.set_attribute(
601585
SPANDATA.SENTRY_DIST, str(client.options["dist"]).strip()

0 commit comments

Comments
 (0)