|
14 | 14 | import java.util.function.UnaryOperator; |
15 | 15 |
|
16 | 16 | /** |
17 | | - * Entry point for the thin smoke trace DSL. Assert a captured trace collection against one {@link |
18 | | - * TraceMatcher} per expected trace: |
| 17 | + * This class is a helper class to verify trace structure. |
19 | 18 | * |
20 | | - * <pre>{@code |
21 | | - * import static datadog.smoketest.trace.SmokeTraceAssertions.assertTraces; |
22 | | - * import static datadog.smoketest.trace.TraceMatcher.trace; |
23 | | - * import static datadog.smoketest.trace.SpanMatcher.span; |
| 19 | + * <p>To check for trace structure, use the static factory methods: {@link #assertTraces(List, |
| 20 | + * TraceMatcher...)} with the expected {@link TraceMatcher}s (one per trace), or {@link |
| 21 | + * #assertTraces(List, UnaryOperator, TraceMatcher...)} to configure the checks with a {@link |
| 22 | + * Options} object. |
24 | 23 | * |
25 | | - * assertTraces(traces, trace(span().operationName("servlet.request").resourceName("GET /greeting"))); |
26 | | - * }</pre> |
27 | | - * |
28 | | - * <p>A single matching algorithm is tuned by three combinable {@link Options}: |
29 | | - * |
30 | | - * <ul> |
31 | | - * <li>{@link #SORT_BY_START_TIME} (the {@code sorter}) — sort the received traces before |
32 | | - * matching, making positional matching deterministic. |
33 | | - * <li>{@link #UNORDERED} — a matcher may match <em>any</em> distinct (unconsumed) trace rather |
34 | | - * than the one at its position; the received order stops mattering (so a {@code sorter} has |
35 | | - * no effect in this mode). |
36 | | - * <li>{@link #IGNORE_ADDITIONAL_TRACES} — don't require every received trace to be matched; extra |
37 | | - * traces are ignored (a subset assertion). Without it, the counts must be equal. |
38 | | - * </ul> |
39 | | - * |
40 | | - * <p>The useful combinations are: |
| 24 | + * <p>The following predefined configurations: |
41 | 25 | * |
42 | 26 | * <ul> |
43 | | - * <li><b>default</b> (optionally with a {@code sorter}) — count-exact positional: matcher |
44 | | - * <i>i</i> ↔ trace <i>i</i>. |
45 | | - * <li><b>{@code sorter} + {@code ignoreAdditionalTraces}</b> — ordered subsequence: match in |
46 | | - * sorted order, skipping the traces no matcher claims. |
47 | | - * <li><b>{@code unordered} + {@code ignoreAdditionalTraces}</b> — any-order subset: match the |
48 | | - * traces you care about and ignore the rest (e.g. a distributed test where connection-setup |
49 | | - * commands land as their own traces alongside the request traces). |
| 27 | + * <li>{@link #IGNORE_ADDITIONAL_TRACES} ignores additional traces if there are more than |
| 28 | + * expected, |
| 29 | + * <li>{@link #SORT_BY_START_TIME} sorts traces by their start time, |
| 30 | + * <li>{@link #UNORDERED} allows matchers to match any distinct trace rather than the one at its |
| 31 | + * position. |
50 | 32 | * </ul> |
51 | | - * |
52 | | - * <p>Combine flags with the fluent {@link Options}, e.g. {@code o -> |
53 | | - * o.unordered().ignoreAdditionalTraces()}. The traces come from a {@code TraceBackend} (mock or |
54 | | - * test-agent), both decoded to {@link DecodedTrace}. |
55 | 33 | */ |
56 | 34 | public final class SmokeTraceAssertions { |
57 | 35 | /* |
|
0 commit comments