File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 2424- Fix log count in client reports ([#4869](https://github.com/getsentry/sentry-java/pull/4869))
2525- Fix profilerId propagation ([#4833](https://github.com/getsentry/sentry-java/pull/4833))
2626- Fix profiling init for Spring and Spring Boot w Agent auto-init ([#4815](https://github.com/getsentry/sentry-java/pull/4815))
27+ - Copy active span on scope clone ([#4878](https://github.com/getsentry/sentry-java/pull/4878))
2728
2829### Improvements
2930
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