You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restore full span assertions in Synapse proxy client test
Replace the minimal span-existence-only assertions added to tolerate
extra traces with full TraceAssert.assertTrace() calls using the
existing serverSpan/proxySpan/clientSpan helpers. The test now
validates service name, operation name, resource name, span type,
error flag, parent–child relationships, tags (component, span kind,
HTTP method/status/URL, peer IP/port), and distributed tracing — while
still tolerating the variable number of internal Synapse traces by
locating each expected trace by its root span resource name before
asserting.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: dd-java-agent/instrumentation/synapse-3.0/src/test/groovy/datadog/trace/instrumentation/synapse3/SynapseTest.groovy
+32-23Lines changed: 32 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -215,35 +215,44 @@ abstract class SynapseTest extends VersionedNamingTestBase {
215
215
int statusCode = client.newCall(request).execute().code()
216
216
217
217
then:
218
-
// Wait for at least 2 traces; Synapse proxy requests can sometimes produce
219
-
// an additional trace from internal activity, so we tolerate extra traces.
218
+
// Synapse proxy handling can occasionally produce extra internal traces beyond the expected two
219
+
// (proxy+client trace and backend server trace), so we wait for at least 2 and filter to the
220
+
// traces we care about rather than asserting on an exact count.
220
221
TEST_WRITER.waitForTraces(2)
221
-
def traces =newArrayList<>(TEST_WRITER)
222
-
assert traces.size() >=2
223
-
Collections.sort(traces, SORT_TRACES_BY_NAMES)
224
-
225
-
// Find key spans across all traces. Synapse can produce variable numbers of traces and spans
226
-
// (e.g. extra internal activity), so we identify spans by resource name across all traces.
assert serverSpan !=null:"Expected server span for forwarded call, found: ${allSpanDescriptions}"
244
-
245
-
// Verify distributed tracing: the client span's traceId was propagated to the server span
246
-
assert clientSpan.traceId == serverSpan.traceId :"Expected client and server spans to share traceId, client traceId=${clientSpan.traceId}, server traceId=${serverSpan.traceId}"
246
+
// Full span assertions using the existing helper methods, applied to each located trace.
0 commit comments