-
Notifications
You must be signed in to change notification settings - Fork 849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve span order #5026
improve span order #5026
Conversation
zeitlinger
commented
Dec 8, 2022
•
edited
Loading
edited
- sort spans by start time (parents before children as tiebreaker) to avoid common causes for flaky tests
04be759
to
618e5d2
Compare
Codecov ReportBase: 91.06% // Head: 91.22% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #5026 +/- ##
============================================
+ Coverage 91.06% 91.22% +0.16%
+ Complexity 4886 4884 -2
============================================
Files 553 553
Lines 14465 14433 -32
Branches 1387 1376 -11
============================================
- Hits 13172 13166 -6
+ Misses 896 883 -13
+ Partials 397 384 -13
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
sdk/testing/src/main/java/io/opentelemetry/sdk/testing/assertj/TracesAssert.java
Show resolved
Hide resolved
I didn't change anything there, just modified the comparator.
Apart from that, this is a typical implicit guarantee in java, because
backwards compatibility is honored.
…On Mon, Dec 12, 2022, 19:19 jason plumb ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
sdk/testing/src/main/java/io/opentelemetry/sdk/testing/assertj/TracesAssert.java
<#5026 (comment)>
:
> @@ -21,6 +25,22 @@
extends AbstractIterableAssert<
TracesAssert, List<List<SpanData>>, List<SpanData>, TraceAssert> {
+ /**
+ * Returns an assertion for a list of traces. The provided spans will be grouped into traces by
+ * their trace ID.
+ */
+ public static TracesAssert assertThat(List<SpanData> spanData) {
+ Map<String, List<SpanData>> traces =
+ spanData.stream()
+ .collect(
+ Collectors.groupingBy(
+ SpanData::getTraceId, LinkedHashMap::new, Collectors.toList()));
+ for (List<SpanData> trace : traces.values()) {
+ trace.sort(SPAN_DATA_COMPARATOR);
Nitpick: I think there's no guarantee that the List returned by
Collectors.toList() is mutable, and Collectors.toCollection(supplier) can
be used as a work-around.
—
Reply to this email directly, view it on GitHub
<#5026 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVTR453WOZZRRYTIJAD3L3WM5UERANCNFSM6AAAAAASYJH2AQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
sdk/testing/src/main/java/io/opentelemetry/sdk/testing/trace/TraceUtil.java
Outdated
Show resolved
Hide resolved
sdk/testing/src/main/java/io/opentelemetry/sdk/testing/trace/TraceUtil.java
Outdated
Show resolved
Hide resolved
sdk/testing/src/main/java/io/opentelemetry/sdk/testing/assertj/TracesAssert.java
Show resolved
Hide resolved
d0be87e
to
7e461b0
Compare
sdk/testing/src/main/java/io/opentelemetry/sdk/testing/assertj/TraceUtil.java
Outdated
Show resolved
Hide resolved
…void common causes for flaky tests
7e461b0
to
b8a7194
Compare