Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dc8d319
feat: Add strict trace continuation support
giortzisg Mar 2, 2026
e550ae3
Format code
getsentry-bot Mar 2, 2026
c272ee4
Add changelog entry
giortzisg Mar 2, 2026
1cfc2ea
Update API surface file for strict trace continuation
giortzisg Mar 3, 2026
108eb2d
Address review comments for strict trace continuation
giortzisg Mar 4, 2026
e30064c
Fix compilation errors after rebase on main
giortzisg Mar 4, 2026
4545735
fix: Move changelog entry to Unreleased section
giortzisg Mar 4, 2026
61ada6a
Format code
getsentry-bot Mar 4, 2026
519f6a6
fix: Address review comments — pass options to PropagationContext, fi…
giortzisg Mar 9, 2026
360fc94
fix: Add missing 8.34.1 changelog section
giortzisg Mar 9, 2026
ea9f456
merge: Resolve changelog conflict with main
giortzisg Mar 9, 2026
58bfc8e
Format code
getsentry-bot Mar 9, 2026
ebe8c4c
fix: Address PR review comments for strict trace continuation
giortzisg Mar 11, 2026
824b30b
Format code
getsentry-bot Mar 11, 2026
e2fdc46
fix(tracing): Clarify strict org validation debug log
adinauer Mar 20, 2026
d3b073d
fix(android): Use enabled suffix for strict trace manifest key
adinauer Mar 20, 2026
f7fef22
fix(api): Mark effective org ID helper as internal
adinauer Mar 20, 2026
71562fa
ref(tracing): Extract trace continuation decision into TracingUtils
adinauer Mar 23, 2026
327d897
fix(opentelemetry): Enforce strict continuation in propagators
adinauer Mar 23, 2026
f1edc98
Merge branch 'main' into feat/strict-trace-continuation
adinauer Mar 23, 2026
863f05b
Format code
getsentry-bot Mar 23, 2026
1d8e301
fix(tracing): Fix empty orgId bypassing DSN fallback
adinauer Mar 26, 2026
25e71db
Merge branch 'main' into feat/strict-trace-continuation
adinauer Mar 26, 2026
a3c86e7
Format code
getsentry-bot Mar 26, 2026
3d1d119
ref: Remove redundant trim of already-trimmed effective org ID
adinauer Mar 27, 2026
bad469f
Merge branch 'main' into feat/strict-trace-continuation
adinauer Mar 30, 2026
cf7d9fe
ref(tracing): Revert shouldContinueTrace check in OtelSentrySpanProce…
adinauer Mar 30, 2026
435d2e7
fix(test): Clean up global Sentry state in SentryPropagatorTest
adinauer Mar 30, 2026
63222e5
fix(test): Use mock scopes in propagator strict continuation tests
adinauer Mar 30, 2026
a4cd81a
fix(test): Reset OTel context in propagator test teardown
adinauer Mar 30, 2026
f029100
Merge branch 'main' into feat/strict-trace-continuation
adinauer Mar 30, 2026
070ee32
fix(test): Add back test for inject with invalid span
adinauer Mar 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(test): Use mock scopes in propagator strict continuation tests
The strict continuation tests called Sentry.init with strict mode and
org ID configuration, which leaked global state into other tests.
Sentry.close() does not fully reset the global scope options, so
SentrySpanProcessorTest's SentryPropagator (using ScopesAdapter) would
reject incoming sentry-trace headers.

Use the package-private constructor with mock IScopes instead of
relying on global Sentry state for strict continuation validation.

Co-Authored-By: Claude <noreply@anthropic.com>
  • Loading branch information
adinauer and claude committed Mar 30, 2026
commit 63222e58c423309cb83c57db6c0d722ea3ea71e2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import io.opentelemetry.context.propagation.TextMapGetter
import io.opentelemetry.context.propagation.TextMapSetter
import io.opentelemetry.semconv.UrlAttributes
import io.sentry.BaggageHeader
import io.sentry.IScopes
import io.sentry.Sentry
import io.sentry.SentryOptions
import io.sentry.SentryTraceHeader
import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_BAGGAGE_KEY
import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_SCOPES_KEY
Expand Down Expand Up @@ -39,6 +41,7 @@ class OtelSentryPropagatorTest {
@AfterTest
fun cleanup() {
spanStorage.clear()
Sentry.close()
}

@Test
Expand Down Expand Up @@ -72,11 +75,14 @@ class OtelSentryPropagatorTest {

@Test
fun `ignores incoming headers when strict continuation rejects org id`() {
Sentry.init { options ->
options.dsn = "https://key@o2.ingest.sentry.io/123"
options.isStrictTraceContinuation = true
}
val propagator = OtelSentryPropagator()
val options =
SentryOptions().apply {
dsn = "https://key@o2.ingest.sentry.io/123"
isStrictTraceContinuation = true
}
val scopes = mock<IScopes>()
whenever(scopes.options).thenReturn(options)
val propagator = OtelSentryPropagator(scopes)
val carrier: Map<String, String> =
mapOf(
"sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,30 @@ package io.sentry.opentelemetry

import io.opentelemetry.api.trace.Span
import io.opentelemetry.context.Context
import io.sentry.Sentry
import io.sentry.IScopes
import io.sentry.SentryOptions
import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_BAGGAGE_KEY
import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_TRACE_KEY
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertNull
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever

class SentryPropagatorTest {

@BeforeTest
fun setup() {
Sentry.init("https://key@sentry.io/proj")
}

@AfterTest
fun teardown() {
Sentry.close()
}

@Suppress("DEPRECATION")
@Test
fun `ignores incoming headers when strict continuation rejects org id`() {
Sentry.init { options ->
options.dsn = "https://key@o2.ingest.sentry.io/123"
options.isStrictTraceContinuation = true
}

val propagator = SentryPropagator()
val options =
SentryOptions().apply {
dsn = "https://key@o2.ingest.sentry.io/123"
isStrictTraceContinuation = true
}
val scopes = mock<IScopes>()
whenever(scopes.options).thenReturn(options)

val propagator = SentryPropagator(scopes)
val carrier: Map<String, String> =
mapOf(
"sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ import io.opentelemetry.context.Context
import io.opentelemetry.context.propagation.TextMapGetter
import io.opentelemetry.context.propagation.TextMapSetter
import io.sentry.Baggage
import io.sentry.IScopes
import io.sentry.Sentry
import io.sentry.SentryOptions
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNull
import kotlin.test.assertTrue
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever

class OpenTelemetryOtlpPropagatorTest {

Expand All @@ -23,6 +28,11 @@ class OpenTelemetryOtlpPropagatorTest {
Sentry.init("https://key@sentry.io/proj")
}

@AfterTest
fun teardown() {
Sentry.close()
}

@Test
fun `propagator registers for sentry-trace and baggage`() {
val propagator = OpenTelemetryOtlpPropagator()
Expand All @@ -48,11 +58,14 @@ class OpenTelemetryOtlpPropagatorTest {

@Test
fun `ignores incoming headers when strict continuation rejects org id`() {
Sentry.init { options ->
options.dsn = "https://key@o2.ingest.sentry.io/123"
options.isStrictTraceContinuation = true
}
val propagator = OpenTelemetryOtlpPropagator()
val options =
SentryOptions().apply {
dsn = "https://key@o2.ingest.sentry.io/123"
isStrictTraceContinuation = true
}
val scopes = mock<IScopes>()
whenever(scopes.options).thenReturn(options)
val propagator = OpenTelemetryOtlpPropagator(scopes)
val carrier: Map<String, String> =
mapOf(
"sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1",
Expand Down