Remove service name split by tags
MODIFY
dd-trace-api/src/main/java/datadog/trace/api/Config.java
dd-trace-api/src/main/java/datadog/trace/api/Config.java
@@ -8,7 +8,6 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -69,7 +68,6 @@ public class Config {
public static final String HTTP_CLIENT_TAG_QUERY_STRING = "http.client.tag.query-string";
public static final String HTTP_CLIENT_HOST_SPLIT_BY_DOMAIN = "trace.http.client.split-by-domain";
public static final String DB_CLIENT_HOST_SPLIT_BY_INSTANCE = "trace.db.client.split-by-instance";
- public static final String SPLIT_BY_TAGS = "trace.split-by-tags";
public static final String PARTIAL_FLUSH_MIN_SPANS = "trace.partial.flush.min.spans";
public static final String RUNTIME_CONTEXT_FIELD_INJECTION =
"trace.runtime.context.field.injection";
@@ -111,7 +109,6 @@ public class Config {
private static final boolean DEFAULT_HTTP_CLIENT_TAG_QUERY_STRING = false;
private static final boolean DEFAULT_HTTP_CLIENT_SPLIT_BY_DOMAIN = false;
private static final boolean DEFAULT_DB_CLIENT_HOST_SPLIT_BY_INSTANCE = false;
- private static final String DEFAULT_SPLIT_BY_TAGS = "";
private static final int DEFAULT_PARTIAL_FLUSH_MIN_SPANS = 1000;
private static final String DEFAULT_PROPAGATION_STYLE_EXTRACT = PropagationStyle.DATADOG.name();
private static final String DEFAULT_PROPAGATION_STYLE_INJECT = PropagationStyle.DATADOG.name();
@@ -164,7 +161,6 @@ public class Config {
@Getter private final boolean httpClientTagQueryString;
@Getter private final boolean httpClientSplitByDomain;
@Getter private final boolean dbClientSplitByInstance;
- @Getter private final Set<String> splitByTags;
@Getter private final Integer partialFlushMinSpans;
@Getter private final boolean runtimeContextFieldInjection;
@Getter private final Set<PropagationStyle> propagationStylesToExtract;
@@ -243,11 +239,6 @@ public class Config {
getBooleanSettingFromEnvironment(
DB_CLIENT_HOST_SPLIT_BY_INSTANCE, DEFAULT_DB_CLIENT_HOST_SPLIT_BY_INSTANCE);
- splitByTags =
- Collections.unmodifiableSet(
- new LinkedHashSet<>(
- getListSettingFromEnvironment(SPLIT_BY_TAGS, DEFAULT_SPLIT_BY_TAGS)));
-
partialFlushMinSpans =
getIntegerSettingFromEnvironment(PARTIAL_FLUSH_MIN_SPANS, DEFAULT_PARTIAL_FLUSH_MIN_SPANS);
@@ -345,12 +336,6 @@ public class Config {
getPropertyBooleanValue(
properties, DB_CLIENT_HOST_SPLIT_BY_INSTANCE, parent.dbClientSplitByInstance);
- splitByTags =
- Collections.unmodifiableSet(
- new LinkedHashSet<>(
- getPropertyListValue(
- properties, SPLIT_BY_TAGS, new ArrayList<>(parent.splitByTags))));
-
partialFlushMinSpans =
getPropertyIntegerValue(properties, PARTIAL_FLUSH_MIN_SPANS, parent.partialFlushMinSpans);

MODIFY
dd-trace-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy
dd-trace-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy
@@ -29,7 +29,6 @@ import static datadog.trace.api.Config.SERVICE_MAPPING
import static datadog.trace.api.Config.SERVICE_NAME
import static datadog.trace.api.Config.SERVICE_TAG
import static datadog.trace.api.Config.SPAN_TAGS
-import static datadog.trace.api.Config.SPLIT_BY_TAGS
import static datadog.trace.api.Config.TRACE_AGENT_PORT
import static datadog.trace.api.Config.TRACE_ENABLED
import static datadog.trace.api.Config.TRACE_REPORT_HOSTNAME
@@ -74,7 +73,6 @@ class ConfigTest extends DDSpecification {
config.httpClientErrorStatuses == (400..499).toSet()
config.httpClientSplitByDomain == false
config.dbClientSplitByInstance == false
- config.splitByTags == [].toSet()
config.partialFlushMinSpans == 1000
config.reportHostName == false
config.runtimeContextFieldInjection == true
@@ -113,7 +111,6 @@ class ConfigTest extends DDSpecification {
prop.setProperty(HTTP_CLIENT_ERROR_STATUSES, "111")
prop.setProperty(HTTP_CLIENT_HOST_SPLIT_BY_DOMAIN, "true")
prop.setProperty(DB_CLIENT_HOST_SPLIT_BY_INSTANCE, "true")
- prop.setProperty(SPLIT_BY_TAGS, "some.tag1,some.tag2,some.tag1")
prop.setProperty(PARTIAL_FLUSH_MIN_SPANS, "15")
prop.setProperty(TRACE_REPORT_HOSTNAME, "true")
prop.setProperty(RUNTIME_CONTEXT_FIELD_INJECTION, "false")
@@ -142,7 +139,6 @@ class ConfigTest extends DDSpecification {
config.httpClientErrorStatuses == (111..111).toSet()
config.httpClientSplitByDomain == true
config.dbClientSplitByInstance == true
- config.splitByTags == ["some.tag1", "some.tag2"].toSet()
config.partialFlushMinSpans == 15
config.reportHostName == true
config.runtimeContextFieldInjection == false
@@ -172,7 +168,6 @@ class ConfigTest extends DDSpecification {
System.setProperty(PREFIX + HTTP_CLIENT_ERROR_STATUSES, "111")
System.setProperty(PREFIX + HTTP_CLIENT_HOST_SPLIT_BY_DOMAIN, "true")
System.setProperty(PREFIX + DB_CLIENT_HOST_SPLIT_BY_INSTANCE, "true")
- System.setProperty(PREFIX + SPLIT_BY_TAGS, "some.tag3, some.tag2, some.tag1")
System.setProperty(PREFIX + PARTIAL_FLUSH_MIN_SPANS, "25")
System.setProperty(PREFIX + TRACE_REPORT_HOSTNAME, "true")
System.setProperty(PREFIX + RUNTIME_CONTEXT_FIELD_INJECTION, "false")
@@ -201,7 +196,6 @@ class ConfigTest extends DDSpecification {
config.httpClientErrorStatuses == (111..111).toSet()
config.httpClientSplitByDomain == true
config.dbClientSplitByInstance == true
- config.splitByTags == ["some.tag3", "some.tag2", "some.tag1"].toSet()
config.partialFlushMinSpans == 25
config.reportHostName == true
config.runtimeContextFieldInjection == false
@@ -290,7 +284,6 @@ class ConfigTest extends DDSpecification {
config.httpClientErrorStatuses == (400..499).toSet()
config.httpClientSplitByDomain == false
config.dbClientSplitByInstance == false
- config.splitByTags == [].toSet()
config.propagationStylesToExtract.toList() == [Config.PropagationStyle.DATADOG]
config.propagationStylesToInject.toList() == [Config.PropagationStyle.DATADOG]
}
@@ -379,7 +372,6 @@ class ConfigTest extends DDSpecification {
config.httpClientErrorStatuses == (111..111).toSet()
config.httpClientSplitByDomain == true
config.dbClientSplitByInstance == true
- config.splitByTags == [].toSet()
config.partialFlushMinSpans == 15
config.propagationStylesToExtract.toList() == [Config.PropagationStyle.B3, Config.PropagationStyle.DATADOG]
config.propagationStylesToInject.toList() == [Config.PropagationStyle.DATADOG, Config.PropagationStyle.B3]

MODIFY
dd-trace-ot/src/main/java/datadog/opentracing/decorators/DDDecoratorsFactory.java
dd-trace-ot/src/main/java/datadog/opentracing/decorators/DDDecoratorsFactory.java
package datadog.opentracing.decorators;
-import datadog.trace.api.Config;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -9,9 +7,7 @@ import java.util.List;
public class DDDecoratorsFactory {
public static List<AbstractDecorator> createBuiltinDecorators() {
- final List<AbstractDecorator> decorators =
- new ArrayList<>(
- Arrays.asList(
+ return Arrays.asList(
new DBStatementAsResourceName(),
new DBTypeDecorator(),
new ErrorFlag(),
@@ -19,17 +15,11 @@ public class DDDecoratorsFactory {
new PeerServiceDecorator(),
new ResourceNameDecorator(),
new ServiceNameDecorator(),
- new ServiceNameDecorator("service", false),
+ new ServiceNameDecorator("service"),
new ServletContextDecorator(),
new SpanTypeDecorator(),
new Status404Decorator(),
new Status5XXDecorator(),
- new URLAsResourceName()));
-
- for (final String splitByTag : Config.get().getSplitByTags()) {
- decorators.add(new ServiceNameDecorator(splitByTag, true));
- }
-
- return decorators;
+ new URLAsResourceName());
}
}

MODIFY
dd-trace-ot/src/main/java/datadog/opentracing/decorators/ServiceNameDecorator.java
dd-trace-ot/src/main/java/datadog/opentracing/decorators/ServiceNameDecorator.java
@@ -5,21 +5,17 @@ import datadog.trace.api.DDTags;
public class ServiceNameDecorator extends AbstractDecorator {
- private final boolean setTag;
-
public ServiceNameDecorator() {
- this(DDTags.SERVICE_NAME, false);
+ this(DDTags.SERVICE_NAME);
}
- public ServiceNameDecorator(final String splitByTag, final boolean setTag) {
- super();
- this.setTag = setTag;
- setMatchingTag(splitByTag);
+ public ServiceNameDecorator(final String tagName) {
+ setMatchingTag(tagName);
}
@Override
public boolean shouldSetTag(final DDSpanContext context, final String tag, final Object value) {
context.setServiceName(String.valueOf(value));
- return setTag;
+ return false;
}
}

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/decorators/SpanDecoratorTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/decorators/SpanDecoratorTest.groovy
@@ -3,8 +3,6 @@ package datadog.opentracing.decorators
import datadog.opentracing.DDSpanContext
import datadog.opentracing.DDTracer
import datadog.opentracing.SpanFactory
-import datadog.trace.agent.test.utils.ConfigUtils
-import datadog.trace.api.Config
import datadog.trace.api.DDSpanTypes
import datadog.trace.api.DDTags
import datadog.trace.common.writer.LoggingWriter
@@ -16,17 +14,7 @@ import static datadog.trace.api.Config.DEFAULT_SERVICE_NAME
import static java.util.Collections.emptyMap
class SpanDecoratorTest extends DDSpecification {
- static {
- ConfigUtils.updateConfig {
- System.setProperty("dd.$Config.SPLIT_BY_TAGS", "sn.tag1,sn.tag2")
- }
- }
- def cleanupSpec() {
- ConfigUtils.updateConfig {
- System.clearProperty("dd.$Config.SPLIT_BY_TAGS")
- }
- }
def tracer = new DDTracer(new LoggingWriter())
def span = SpanFactory.newSpanOf(tracer)
@@ -77,10 +65,6 @@ class SpanDecoratorTest extends DDSpecification {
"service" | "other-service" | "other-service"
Tags.PEER_SERVICE.key | "some-service" | "new-service"
Tags.PEER_SERVICE.key | "other-service" | "other-service"
- "sn.tag1" | "some-service" | "new-service"
- "sn.tag1" | "other-service" | "other-service"
- "sn.tag2" | "some-service" | "new-service"
- "sn.tag2" | "other-service" | "other-service"
mapping = ["some-service": "new-service"]
}
@@ -295,12 +279,6 @@ class SpanDecoratorTest extends DDSpecification {
}
def "decorators apply to builder too"() {
- when:
- def span = tracer.buildSpan("decorator.test").withTag("sn.tag1", "some val").start()
-
- then:
- span.serviceName == "some val"
-
when:
span = tracer.buildSpan("decorator.test").withTag("servlet.context", "/my-servlet").start()

Remove service name split by tags (#20)