Skip to content

Commit 8718b22

Browse files
committed
Fixed even more tests
1 parent 3433f48 commit 8718b22

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

dd-java-agent/instrumentation/kafka-clients-0.11/src/test/groovy/KafkaClientTestBase.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,7 @@ abstract class KafkaClientTestBase extends VersionedNamingTestBase {
919919
if (isDataStreamsEnabled()) {
920920
StatsGroup first = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == 0 }
921921
verifyAll(first) {
922-
edgeTags == ["direction:out", "kafka_cluster_id:$clusterId", "topic:$SHARED_TOPIC".toString(), "type:kafka"]
923-
edgeTags.size() == 4
922+
tags == DataStreamsTags.fromTags("direction:out", "kafka_cluster_id:$clusterId", "topic:$SHARED_TOPIC".toString(), "type:kafka")
924923
}
925924

926925
StatsGroup second = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == first.hash }

dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,6 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
638638
StatsGroup first = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == 0 }
639639
verifyAll(first) {
640640
tags == DSM_EDGE_TAGS
641-
tags.getSize() == DSM_EDGE_TAGS.getSize()
642641
}
643642
}
644643

@@ -726,7 +725,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
726725
if (isDataStreamsEnabled()) {
727726
StatsGroup first = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == 0 }
728727
verifyAll(first) {
729-
tags == edgeTags
728+
tags == DSM_EDGE_TAGS
730729
}
731730
}
732731

dd-trace-core/src/main/java/datadog/trace/core/datastreams/DefaultPathwayContext.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ public synchronized void setCheckpoint(
8787
long startNanos = timeSource.getCurrentTimeNanos();
8888
long nanoTicks = timeSource.getNanoTicks();
8989

90-
PathwayHashBuilder pathwayHashBuilder =
91-
new PathwayHashBuilder(hashOfKnownTags, serviceNameOverride);
92-
9390
if (!started) {
9491
long defaultTimestamp = context.defaultTimestamp();
9592
if (defaultTimestamp == 0) {
@@ -146,7 +143,6 @@ public synchronized void setCheckpoint(
146143
hash = newHash;
147144

148145
pointConsumer.accept(point);
149-
log.debug("Checkpoint set {}, hash source: {}", this, pathwayHashBuilder);
150146
}
151147

152148
@Override
@@ -272,21 +268,6 @@ private static DefaultPathwayContext decode(
272268
serviceNameOverride);
273269
}
274270

275-
private static class PathwayHashBuilder {
276-
private long hash;
277-
278-
public PathwayHashBuilder(long baseHash, String serviceNameOverride) {
279-
hash = baseHash;
280-
if (serviceNameOverride != null) {
281-
addTag(serviceNameOverride);
282-
}
283-
}
284-
285-
public void addTag(String tag) {
286-
hash = FNV64Hash.continueHash(hash, tag, FNV64Hash.Version.v1);
287-
}
288-
}
289-
290271
public static long getBaseHash(WellKnownTags wellKnownTags) {
291272
StringBuilder builder = new StringBuilder();
292273
builder.append(wellKnownTags.getService());

internal-api/src/test/groovy/datadog/trace/api/datastreams/DataStreamsTagsTest.groovy

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,24 @@ class DataStreamsTagsTest extends Specification {
6464
one != three
6565
two != three
6666
}
67+
68+
def 'test from tags'() {
69+
setup:
70+
def one = DataStreamsTags.fromTags("direction:in", "topic:abc")
71+
expect:
72+
one.nonNullSize() == 2
73+
one.direction == "direction:in"
74+
one.topic == "topic:abc"
75+
}
76+
77+
def 'test create'() {
78+
setup:
79+
def one = DataStreamsTags.create("type", DataStreamsTags.Direction.Outbound)
80+
def two = DataStreamsTags.create("type", DataStreamsTags.Direction.Outbound, "topic")
81+
def three = DataStreamsTags.create("type", DataStreamsTags.Direction.Outbound, "topic", "group", "cluster")
82+
expect:
83+
one == DataStreamsTags.fromTags("type:type", "direction:out")
84+
two == DataStreamsTags.fromTags("type:type", "direction:out", "topic:topic")
85+
three == DataStreamsTags.fromTags("type:type", "direction:out", "topic:topic", "group:group", "kafka_cluster_id:cluster")
86+
}
6787
}

0 commit comments

Comments
 (0)