File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -917,6 +917,12 @@ class SPANDATA:
917917 Example: 12345
918918 """
919919
920+ PROCESS_COMMAND_ARGS = "process.command_args"
921+ """
922+ All the command arguments (including the command/executable itself) as received by the process.
923+ Example: ["cmd/otecol","--config=config.yaml"]
924+ """
925+
920926 PROFILER_ID = "profiler_id"
921927 """
922928 Label identifying the profiler id that the span occurred in. This should be a string.
@@ -1080,6 +1086,36 @@ class SPANDATA:
10801086 Example: "a1b2c3d4e5f6"
10811087 """
10821088
1089+ SENTRY_DIST = "sentry.dist"
1090+ """
1091+ The Sentry dist.
1092+ Example: "1.0"
1093+ """
1094+
1095+ SENTRY_ENVIRONMENT = "sentry.environment"
1096+ """
1097+ The Sentry environment.
1098+ Example: "prod"
1099+ """
1100+
1101+ SENTRY_RELEASE = "sentry.release"
1102+ """
1103+ The Sentry release.
1104+ Example: "1.2.3"
1105+ """
1106+
1107+ SENTRY_PLATFORM = "sentry.platform"
1108+ """
1109+ The sdk platform that generated the event.
1110+ Example: "python"
1111+ """
1112+
1113+ SENTRY_SDK_INTEGRATIONS = "sentry.sdk.integrations"
1114+ """
1115+ A list of names identifying enabled integrations.
1116+ Example: ["AtexitIntegration", "StdlibIntegration"]
1117+ """
1118+
10831119
10841120class SPANSTATUS :
10851121 """
Original file line number Diff line number Diff line change @@ -572,7 +572,26 @@ def _set_segment_attributes(self) -> None:
572572 if not self ._is_segment ():
573573 return
574574
575- self .set_attribute ("process.command_args" , sys .argv )
575+ client = sentry_sdk .get_client ()
576+
577+ self .set_attribute (SPANDATA .SENTRY_PLATFORM , "python" )
578+ self .set_attribute (SPANDATA .PROCESS_COMMAND_ARGS , sys .argv )
579+ self .set_attribute (
580+ SPANDATA .SENTRY_SDK_INTEGRATIONS , sorted (client .integrations .keys ())
581+ )
582+
583+ if client .options .get ("release" ):
584+ self .set_attribute (
585+ SPANDATA .SENTRY_RELEASE , client .options ["release" ].strip ()
586+ )
587+
588+ if client .options .get ("environment" ):
589+ self .set_attribute (
590+ SPANDATA .SENTRY_ENVIRONMENT , client .options ["environment" ].strip ()
591+ )
592+
593+ if client .options .get ("dist" ):
594+ self .set_attribute (SPANDATA .SENTRY_DIST , client .options ["dist" ].strip ())
576595
577596 def _to_json (self ) -> "SpanJSON" :
578597 res : "SpanJSON" = {
Original file line number Diff line number Diff line change @@ -1624,12 +1624,12 @@ def _matches(rule: "Any", value: "Any") -> bool:
16241624 name_matches = True
16251625 attributes_match = True
16261626
1627- attributes = attributes or {}
1628-
16291627 if "name" in rule :
16301628 name_matches = _matches (rule ["name" ], name )
16311629
16321630 if "attributes" in rule :
1631+ attributes = attributes or {}
1632+
16331633 for attribute , value in rule ["attributes" ].items ():
16341634 if attribute not in attributes or not _matches (
16351635 value , attributes [attribute ]
You can’t perform that action at this time.
0 commit comments