From 32335dde277fa4467826170bf8a659a109921d60 Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Mon, 8 Jul 2024 03:51:55 -0400 Subject: [PATCH] fix(profiling): profiler_id uses underscore (#3249) Relay expects this with an underscore instead of a dot. --- sentry_sdk/consts.py | 2 +- sentry_sdk/tracing.py | 4 ++-- tests/profiler/test_continuous_profiler.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 3e9f67c4be..bc67bef5f7 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -379,7 +379,7 @@ class SPANDATA: Example: "MainThread" """ - PROFILER_ID = "profiler.id" + PROFILER_ID = "profiler_id" """ Label identifying the profiler id that the span occurred in. This should be a string. Example: "5249fbada8d5416482c2f6e47e337372" diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index 96ef81496f..fe8293d645 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -115,7 +115,7 @@ class TransactionKwargs(SpanKwargs, total=False): ProfileContext = TypedDict( "ProfileContext", { - "profiler.id": str, + "profiler_id": str, }, ) @@ -693,7 +693,7 @@ def get_profile_context(self): return None return { - "profiler.id": profiler_id, + "profiler_id": profiler_id, } diff --git a/tests/profiler/test_continuous_profiler.py b/tests/profiler/test_continuous_profiler.py index 2fedbbdd7d..9cf5dadc8d 100644 --- a/tests/profiler/test_continuous_profiler.py +++ b/tests/profiler/test_continuous_profiler.py @@ -101,16 +101,16 @@ def assert_single_transaction_with_profile_chunks(envelopes, thread): ) profile_context = transaction["contexts"]["profile"] - profiler_id = profile_context["profiler.id"] + profiler_id = profile_context["profiler_id"] - assert profile_context == ApproxDict({"profiler.id": profiler_id}) + assert profile_context == ApproxDict({"profiler_id": profiler_id}) spans = transaction["spans"] assert len(spans) > 0 for span in spans: assert span["data"] == ApproxDict( { - "profiler.id": profiler_id, + "profiler_id": profiler_id, "thread.id": str(thread.ident), "thread.name": thread.name, }