@@ -8,6 +8,7 @@ package test.vaadin
88
99import com.vaadin.flow.server.Version
1010import io.opentelemetry.api.trace.SpanKind
11+ import io.opentelemetry.sdk.trace.data.SpanData
1112
1213abstract class AbstractVaadin16Test extends AbstractVaadinTest {
1314 static final boolean VAADIN_17 = Version . majorVersion >= 4
@@ -55,6 +56,7 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
5556 childOf span(0 )
5657 }
5758 int spanIndex = 2
59+ sortHandlerSpans(spans, spanIndex, handlers)
5860 handlers. each { handler ->
5961 span(spanIndex++ ) {
6062 name handler + " .handleRequest"
@@ -73,6 +75,7 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
7375 }
7476
7577 int spanIndex = 2
78+ sortHandlerSpans(spans, spanIndex, handlers)
7679 handlers. each { handler ->
7780 span(spanIndex++ ) {
7881 name handler + " .handleRequest"
@@ -101,6 +104,7 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
101104 childOf span(0 )
102105 }
103106 int spanIndex = 2
107+ sortHandlerSpans(spans, spanIndex, handlers)
104108 handlers. each { handler ->
105109 span(spanIndex++ ) {
106110 name handler + " .handleRequest"
@@ -133,6 +137,7 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
133137 }
134138
135139 int spanIndex = 2
140+ sortHandlerSpans(spans, spanIndex, handlers)
136141 handlers. each { handler ->
137142 span(spanIndex++ ) {
138143 name handler + " .handleRequest"
@@ -149,4 +154,12 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
149154 }
150155 }
151156 }
157+
158+ static void sortHandlerSpans (List<SpanData > spans , int startIndex , List<String > handlers ) {
159+ spans. subList(startIndex, startIndex + handlers. size()). sort({
160+ // strip .handleRequest from span name to get the handler name
161+ def handlerName = it. name. substring(0 , it. name. indexOf(' .' ))
162+ return handlers. indexOf(handlerName)
163+ })
164+ }
152165}
0 commit comments