File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919- Removed SentryExecutorService limit for delayed scheduled tasks ([#4846](https://github.com/getsentry/sentry-java/pull/4846))
2020- Fix visual artifacts for the Canvas strategy on some devices ([#4861](https://github.com/getsentry/sentry-java/pull/4861))
21+ - Copy active span on scope clone ([#4878](https://github.com/getsentry/sentry-java/pull/4878))
2122
2223### Improvements
2324
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ public Scope(final @NotNull SentryOptions options) {
124124 private Scope (final @ NotNull Scope scope ) {
125125 this .transaction = scope .transaction ;
126126 this .transactionName = scope .transactionName ;
127+ this .activeSpan = scope .activeSpan ;
127128 this .session = scope .session ;
128129 this .options = scope .options ;
129130 this .level = scope .level ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import kotlin.test.assertFalse
1212import kotlin.test.assertNotNull
1313import kotlin.test.assertNotSame
1414import kotlin.test.assertNull
15+ import kotlin.test.assertSame
1516import kotlin.test.assertTrue
1617import org.junit.Assert.assertArrayEquals
1718import org.mockito.kotlin.any
@@ -155,6 +156,21 @@ class ScopeTest {
155156 assertEquals(attachment.contentType, actual.contentType)
156157 }
157158
159+ @Test
160+ fun `copying scope copies active span` () {
161+ val scope = Scope (SentryOptions ())
162+
163+ val transaction =
164+ SentryTracer (TransactionContext (" transaction-name" , " op" ), NoOpScopes .getInstance())
165+ val span = transaction.startChild(" child1" )
166+
167+ scope.setActiveSpan(span)
168+
169+ val clone = scope.clone()
170+
171+ assertSame(span, clone.span)
172+ }
173+
158174 @Test
159175 fun `copying scope and changing the original values wont change the clone values` () {
160176 val scope = Scope (SentryOptions ())
You can’t perform that action at this time.
0 commit comments