|
1 | 1 | package datadog.communication.monitor |
2 | 2 |
|
| 3 | +import static datadog.trace.api.config.GeneralConfig.EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED |
3 | 4 |
|
| 5 | +import datadog.trace.api.ProcessTags |
4 | 6 | import datadog.trace.test.util.DDSpecification |
5 | 7 |
|
6 | 8 | import static datadog.trace.api.config.GeneralConfig.DOGSTATSD_START_DELAY |
@@ -109,13 +111,42 @@ class DDAgentStatsDClientTest extends DDSpecification { |
109 | 111 | where: |
110 | 112 | // spotless:off |
111 | 113 | namespace | constantTags | expectedMetricName | expectedCheckName | expectedTags |
112 | | - null | null | "test.metric" | "test.check" | "jmx_domain:java.nio,type:BufferPool" |
113 | | - null | ["lang:java", "lang_version:1.8.0"] | "test.metric" | "test.check" | "jmx_domain:java.nio,type:BufferPool,lang:java,lang_version:1.8.0" |
114 | | - "example" | null | "example.test.metric" | "example.test.check" | "jmx_domain:java.nio,type:BufferPool" |
115 | | - "example" | ["lang:java", "lang_version:1.8.0"] | "example.test.metric" | "example.test.check" | "jmx_domain:java.nio,type:BufferPool,lang:java,lang_version:1.8.0" |
| 114 | + null | null | "test.metric" | "test.check" | "jmx_domain:java.nio,type:BufferPool,${ProcessTags.getTagsForSerialization().toString()}" |
| 115 | + null | ["lang:java", "lang_version:1.8.0"] | "test.metric" | "test.check" | "jmx_domain:java.nio,type:BufferPool,lang:java,lang_version:1.8.0,${ProcessTags.getTagsForSerialization().toString()}" |
| 116 | + "example" | null | "example.test.metric" | "example.test.check" | "jmx_domain:java.nio,type:BufferPool,${ProcessTags.getTagsForSerialization().toString()}" |
| 117 | + "example" | ["lang:java", "lang_version:1.8.0"] | "example.test.metric" | "example.test.check" | "jmx_domain:java.nio,type:BufferPool,lang:java,lang_version:1.8.0,${ProcessTags.getTagsForSerialization().toString()}" |
116 | 118 | // spotless:on |
117 | 119 | } |
118 | 120 |
|
| 121 | + def "single statsd client without process tags"() { |
| 122 | + setup: |
| 123 | + injectSysConfig(DOGSTATSD_START_DELAY, '0') |
| 124 | + injectSysConfig(EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED, "false") |
| 125 | + def server = new StatsDServer() |
| 126 | + server.start() |
| 127 | + ProcessTags.reset() |
| 128 | + |
| 129 | + def client = statsDClientManager().statsDClient('127.0.0.1', server.socket.localPort, null, namespace, constantTags as String[], false) |
| 130 | + |
| 131 | + String metricName = "test.metric" |
| 132 | + String[] tags = ["test:true"] |
| 133 | + |
| 134 | + when: |
| 135 | + client.incrementCounter(metricName, tags) |
| 136 | + |
| 137 | + then: |
| 138 | + server.waitForMessage().startsWith("$expectedMetricName:1|c|#$expectedTags") |
| 139 | + |
| 140 | + cleanup: |
| 141 | + injectSysConfig(EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED, "true") |
| 142 | + ProcessTags.reset() |
| 143 | + |
| 144 | + where: |
| 145 | + namespace | constantTags | expectedMetricName | expectedTags |
| 146 | + null | null | "test.metric" | "test:true" |
| 147 | + null | ["lang:java", "lang_version:1.8.0"] | "test.metric" | "test:true,lang:java,lang_version:1.8.0" |
| 148 | + } |
| 149 | + |
119 | 150 | def "single statsd client with event"() { |
120 | 151 | setup: |
121 | 152 | injectSysConfig(DOGSTATSD_START_DELAY, '0') |
|
0 commit comments