-
Notifications
You must be signed in to change notification settings - Fork 335
Expand file tree
/
Copy pathOpenTelemetry147ActivationTest.groovy
More file actions
56 lines (46 loc) · 1.38 KB
/
OpenTelemetry147ActivationTest.groovy
File metadata and controls
56 lines (46 loc) · 1.38 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import datadog.trace.agent.test.InstrumentationSpecification
import io.opentelemetry.api.GlobalOpenTelemetry
abstract class OpenTelemetry147ActivationTest extends InstrumentationSpecification {
abstract boolean shouldBeInjected()
def "test instrumentation injection"() {
setup:
def meter = GlobalOpenTelemetry.get().meterProvider.get("some-instrumentation")
expect:
if (shouldBeInjected()) {
assert meter.class.name.endsWith(".OtelMeter")
} else {
assert meter.class.name.endsWith(".DefaultMeter")
}
}
}
//
// Below test variants are forked to allow GlobalOpenTelemetry static state to reset
//
class OpenTelemetry147ActivationByInstrumentationNameForkedTest extends OpenTelemetry147ActivationTest {
@Override
void configurePreAgent() {
super.configurePreAgent()
injectSysConfig("integration.opentelemetry-metrics.enabled", "true")
}
@Override
boolean shouldBeInjected() {
return true
}
}
class OpenTelemetry147ActivationByOtelRfcNameForkedTest extends OpenTelemetry147ActivationTest {
@Override
void configurePreAgent() {
super.configurePreAgent()
injectSysConfig("metrics.otel.enabled", "true")
}
@Override
boolean shouldBeInjected() {
return true
}
}
class OpenTelemetry147DisableByDefaultForkedTest extends OpenTelemetry147ActivationTest {
@Override
boolean shouldBeInjected() {
return false
}
}