Skip to content

Commit 9ca0f51

Browse files
committed
Added tests for tags
1 parent fac8b25 commit 9ca0f51

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

internal-api/src/main/java/datadog/trace/api/datastreams/DataStreamsTags.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public String getType() {
314314
return this.type;
315315
}
316316

317-
public String isManual() {
317+
public String getIsManual() {
318318
return this.isManual;
319319
}
320320

@@ -346,6 +346,10 @@ public String getGroup() {
346346
return this.group;
347347
}
348348

349+
public String getConsumerGroup() {
350+
return this.consumerGroup;
351+
}
352+
349353
public String getPartition() {
350354
return this.partition;
351355
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package datadog.trace.api.datastreams
2+
3+
import spock.lang.Specification
4+
5+
6+
class DataStreamsTagsTest extends Specification {
7+
def getTags(int idx) {
8+
return new DataStreamsTags("bus" + idx, DataStreamsTags.Direction.Outbound, "exchange" + idx, "topic" + idx, "type" + idx, "subscription" + idx,
9+
"dataset_name" + idx, "dataset_namespace" + idx, true, "group" + idx, "consumer_group" + idx, true,
10+
"kafka_cluster_id" + idx, "partition" + idx)
11+
}
12+
13+
def 'test tags are properly set'() {
14+
setup:
15+
def tg = getTags(0)
16+
17+
expect:
18+
tg.getBus() == DataStreamsTags.BUS_TAG + ":bus0"
19+
tg.getDirection() == DataStreamsTags.DIRECTION_TAG + ":out"
20+
tg.getExchange() == DataStreamsTags.EXCHANGE_TAG + ":exchange0"
21+
tg.getTopic() == DataStreamsTags.TOPIC_TAG + ":topic0"
22+
tg.getType() == DataStreamsTags.TYPE_TAG + ":type0"
23+
tg.getSubscription() == DataStreamsTags.SUBSCRIPTION_TAG + ":subscription0"
24+
tg.getDatasetName() == DataStreamsTags.DATASET_NAME_TAG + ":dataset_name0"
25+
tg.getDatasetNamespace() == DataStreamsTags.DATASET_NAMESPACE_TAG + ":dataset_namespace0"
26+
tg.getIsManual() == DataStreamsTags.MANUAL_TAG + ":true"
27+
tg.getGroup() == DataStreamsTags.GROUP_TAG + ":group0"
28+
tg.getConsumerGroup() == DataStreamsTags.CONSUMER_GROUP_TAG + ":consumer_group0"
29+
tg.getHasRoutingKey() == DataStreamsTags.HAS_ROUTING_KEY_TAG + ":true"
30+
tg.getKafkaClusterId() == DataStreamsTags.KAFKA_CLUSTER_ID_TAG + ":kafka_cluster_id0"
31+
tg.getPartition() == DataStreamsTags.PARTITION_TAG + ":partition0"
32+
}
33+
}

0 commit comments

Comments
 (0)