Skip to content

Commit d61f2a0

Browse files
dougqhclaude
andcommitted
Include additional tags in AggregateEntry test equality contract
The helper's equals() omitted getAdditionalTags() while keyHash folds it in, so entries differing only in additional tags compared equal yet produced different hash codes -- letting matcher-based tests silently accept missing or wrong additional dimensions. Compare the arrays positionally (schema order) to match the key identity. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 49d370d commit d61f2a0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

dd-trace-core/src/test/java/datadog/trace/common/metrics/AggregateEntryTestUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package datadog.trace.common.metrics;
22

33
import datadog.trace.bootstrap.instrumentation.api.UTF8BytesString;
4+
import java.util.Arrays;
45
import java.util.Collections;
56
import java.util.List;
67
import java.util.Objects;
@@ -174,7 +175,10 @@ public static boolean equals(AggregateEntry a, AggregateEntry b) {
174175
&& a.getPeerTags().equals(b.getPeerTags())
175176
&& Objects.equals(a.getHttpMethod(), b.getHttpMethod())
176177
&& Objects.equals(a.getHttpEndpoint(), b.getHttpEndpoint())
177-
&& Objects.equals(a.getGrpcStatusCode(), b.getGrpcStatusCode());
178+
&& Objects.equals(a.getGrpcStatusCode(), b.getGrpcStatusCode())
179+
// Additional tags are part of the key (folded into keyHash in schema order), so entries
180+
// that differ only in additional tags must not compare equal.
181+
&& Arrays.equals(a.getAdditionalTags(), b.getAdditionalTags());
178182
}
179183

180184
/**

0 commit comments

Comments
 (0)