-
Notifications
You must be signed in to change notification settings - Fork 333
Expand file tree
/
Copy pathConfigInversionMetricCollectorImplTest.groovy
More file actions
41 lines (32 loc) · 1.15 KB
/
ConfigInversionMetricCollectorImplTest.groovy
File metadata and controls
41 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package datadog.trace.api.telemetry
import datadog.trace.test.util.DDSpecification
import static ConfigInversionMetricCollectorImpl.CONFIG_INVERSION_METRIC_NAME
class ConfigInversionMetricCollectorImplTest extends DDSpecification {
def "should emit metric when unsupported env var is used"() {
setup:
def collector = ConfigInversionMetricCollectorImpl.getInstance()
when:
ConfigInversionMetricCollectorTestHelper.checkAndEmitUnsupported("DD_UNKNOWN_FEATURE")
collector.prepareMetrics()
def metrics = collector.drain()
then:
metrics.size() == 1
def metric = metrics[0]
metric.type == 'count'
metric.value == 1
metric.namespace == 'tracers'
metric.metricName == CONFIG_INVERSION_METRIC_NAME
metric.tags.size() == 1
metric.tags[0] == 'config_name:DD_UNKNOWN_FEATURE'
}
def "should not emit metric when supported env var is used"() {
setup:
def collector = ConfigInversionMetricCollectorImpl.getInstance()
when:
ConfigInversionMetricCollectorTestHelper.checkAndEmitUnsupported("DD_ENV")
collector.prepareMetrics()
def metrics = collector.drain()
then:
metrics.isEmpty()
}
}