Tag JMX metrics with `service` in addition to `service.name`
MODIFY
dd-trace-api/src/main/java/datadog/trace/api/Config.java
dd-trace-api/src/main/java/datadog/trace/api/Config.java
@@ -29,6 +29,7 @@ public class Config {
private static final Config INSTANCE = new Config();
public static final String SERVICE_NAME = "service.name";
+ public static final String SERVICE = "service";
public static final String WRITER_TYPE = "writer.type";
public static final String AGENT_HOST = "agent.host";
public static final String TRACE_AGENT_PORT = "trace.agent.port";
@@ -201,7 +202,8 @@ public class Config {
result.putAll(runtimeTags);
// service name set here instead of getRuntimeTags because apm already manages the service tag
// and may chose to override it.
- result.put(SERVICE_NAME, serviceName);
+ // Additionally, infra/JMX metrics require `service` rather than APM's `service.name` tag
+ result.put(SERVICE, serviceName);
return Collections.unmodifiableMap(result);
}

MODIFY
dd-trace-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy
dd-trace-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy
@@ -35,7 +35,7 @@ class ConfigTest extends Specification {
config.traceResolverEnabled == true
config.serviceMapping == [:]
config.mergedSpanTags == [:]
- config.mergedJmxTags == [(RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_NAME): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
+ config.mergedJmxTags == [(RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
config.headerTags == [:]
config.runtimeContextFieldInjection == true
config.jmxFetchEnabled == false
@@ -81,7 +81,7 @@ class ConfigTest extends Specification {
config.traceResolverEnabled == false
config.serviceMapping == [a: "1"]
config.mergedSpanTags == [b: "2", c: "3"]
- config.mergedJmxTags == [b: "2", d: "4", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_NAME): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
+ config.mergedJmxTags == [b: "2", d: "4", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
config.headerTags == [e: "5"]
config.runtimeContextFieldInjection == false
config.jmxFetchEnabled == true
@@ -202,7 +202,7 @@ class ConfigTest extends Specification {
config.traceResolverEnabled == false
config.serviceMapping == [a: "1"]
config.mergedSpanTags == [b: "2", c: "3"]
- config.mergedJmxTags == [b: "2", d: "4", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_NAME): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
+ config.mergedJmxTags == [b: "2", d: "4", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
config.headerTags == [e: "5"]
config.jmxFetchMetricsConfigs == ["/foo.yaml", "/bar.yaml"]
config.jmxFetchCheckPeriod == 100

Tag JMX metrics with `service` in addition to `service.name`