Skip to content

Commit 3b6f426

Browse files
committed
fix: enhance logging for trace continuation org ID mismatch
1 parent 40158f6 commit 3b6f426

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/sentry/opentelemetry/propagator.ex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ if Sentry.OpenTelemetry.VersionChecker.tracing_compatible?() do
1010
import Bitwise
1111

1212
require Record
13+
require Logger
1314
require OpenTelemetry.Tracer, as: Tracer
1415

1516
@behaviour :otel_propagator_text_map
@@ -74,8 +75,9 @@ if Sentry.OpenTelemetry.VersionChecker.tracing_compatible?() do
7475

7576
Tracer.set_current_span(ctx, remote_span_ctx)
7677
else
77-
require Logger
78-
Logger.debug("[Sentry] Not continuing trace due to org ID mismatch")
78+
sdk_org_id = Sentry.Config.effective_org_id()
79+
baggage_org_id = extract_baggage_org_id(raw_baggage)
80+
Logger.warning("[Sentry] Not continuing trace due to org ID mismatch (sdk: #{sdk_org_id}, incoming: #{baggage_org_id})")
7981
ctx
8082
end
8183

@@ -145,7 +147,7 @@ if Sentry.OpenTelemetry.VersionChecker.tracing_compatible?() do
145147
defp ensure_org_id_in_baggage(baggage) when is_binary(baggage) do
146148
org_id = Sentry.Config.effective_org_id()
147149

148-
if org_id != nil and not String.contains?(baggage, "sentry-org_id=") do
150+
if org_id != nil and extract_baggage_org_id(baggage) == nil do
149151
baggage <> ",sentry-org_id=" <> org_id
150152
else
151153
baggage

0 commit comments

Comments
 (0)