Merge pull request #1182 from DataDog/tyler/decorator-disable-case-insensitive

Check for both regular and lowercase names with decorator enabled flags.
This commit is contained in:
Tyler Benson 2020-01-17 12:29:52 -08:00 committed by GitHub
commit b7d599d82f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -591,7 +591,8 @@ public class Config {
} }
public boolean isDecoratorEnabled(final String name) { public boolean isDecoratorEnabled(final String name) {
return getBooleanSettingFromEnvironment("trace." + name.toLowerCase() + ".enabled", true); return getBooleanSettingFromEnvironment("trace." + name + ".enabled", true)
&& getBooleanSettingFromEnvironment("trace." + name.toLowerCase() + ".enabled", true);
} }
/** /**

View File

@ -457,7 +457,7 @@ class SpanDecoratorTest extends DDSpecification {
def "disable decorator via config"() { def "disable decorator via config"() {
setup: setup:
ConfigUtils.updateConfig { ConfigUtils.updateConfig {
System.setProperty("dd.trace." + PeerServiceDecorator.getSimpleName().toLowerCase() + ".enabled", "false") System.setProperty("dd.trace.${decorator}.enabled", "false")
} }
tracer = DDTracer.builder() tracer = DDTracer.builder()
@ -475,8 +475,13 @@ class SpanDecoratorTest extends DDSpecification {
cleanup: cleanup:
ConfigUtils.updateConfig { ConfigUtils.updateConfig {
System.clearProperty("dd.trace." + PeerServiceDecorator.getSimpleName().toLowerCase() + ".enabled") System.clearProperty("dd.trace.${decorator}.enabled")
} }
where:
decorator | _
PeerServiceDecorator.getSimpleName().toLowerCase() | _
PeerServiceDecorator.getSimpleName() | _
} }
def "disabling service decorator does not disable split by tags"() { def "disabling service decorator does not disable split by tags"() {