Skip to content

Commit 6d284a2

Browse files
🛠️ apply pre-commit fixes
1 parent 03e42b0 commit 6d284a2

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

src/sentry/utils/sdk.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -406,27 +406,16 @@ def _capture_anything(self, method_name, *args, **kwargs):
406406
if method_name == "capture_envelope":
407407
if args[0].get_transaction_event() is not None:
408408
is_transaction = True
409-
trace_id = args[0].headers.get("trace", {}).get(
410-
"trace_id"
411-
)
409+
trace_id = args[0].headers.get("trace", {}).get("trace_id")
412410
elif method_name == "capture_event":
413411
if args[0].get("type") == "transaction":
414412
is_transaction = True
415-
trace_id = (
416-
args[0]
417-
.get("contexts", {})
418-
.get("trace", {})
419-
.get("trace_id")
420-
)
413+
trace_id = args[0].get("contexts", {}).get("trace", {}).get("trace_id")
421414
if is_transaction and trace_id is not None:
422-
hash_value = int(
423-
hashlib.md5(trace_id.encode()).hexdigest()[:8], 16
424-
)
415+
hash_value = int(hashlib.md5(trace_id.encode()).hexdigest()[:8], 16)
425416
if hash_value % 100 >= 1:
426417
send_to_s4s = False
427-
metrics.incr(
428-
"internal.captured.events.upstream.s4s2_sampled"
429-
)
418+
metrics.incr("internal.captured.events.upstream.s4s2_sampled")
430419

431420
if send_to_s4s:
432421
metrics.incr("internal.captured.events.upstream")

0 commit comments

Comments
 (0)