Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

### Unreleased

### Fixes

- Do not store No-Op scopes onto OpenTelemetry Context when wrapping ([#4631](https://github.com/getsentry/sentry-java/pull/4631))
- In 8.18.0 and 8.19.0 the SDK could break when initialized too late.

## 8.19.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ coverage:
project:
default:
target: 78%
threshold: 3%
threshold: 4%
patch: off
range: 78...100
precision: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ private <V> boolean isOpentelemetrySpan(final @NotNull ContextKey<V> contextKey)
if (sentrySpan != null) {
forkedScopes.setActiveSpan(sentrySpan);
}
return context.with(SENTRY_SCOPES_KEY, forkedScopes);
if (forkedScopes.isNoOp()) {
return context;
} else {
return context.with(SENTRY_SCOPES_KEY, forkedScopes);
}
}

private static @NotNull IScopes forkCurrentScopeInternal(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.sentry.opentelemetry

import io.opentelemetry.context.Context
import io.sentry.Sentry
import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_SCOPES_KEY
import junit.framework.TestCase.assertNull
import junit.framework.TestCase.assertTrue
import kotlin.test.Test

class SentryContextWrapperTest {

@Test
fun `ensure noop scopes are not stored on Context`() {
val context = Context.root()
assertNull(context.get(SENTRY_SCOPES_KEY))
assertTrue(Sentry.getCurrentScopes().isNoOp)
val wrappedContext = SentryContextWrapper.wrap(context)
assertNull(wrappedContext.get(SENTRY_SCOPES_KEY))
}
}
Loading