Rename DD_PROFILING_SITE to DD_SITE
MODIFY
dd-trace-api/src/main/java/datadog/trace/api/Config.java
dd-trace-api/src/main/java/datadog/trace/api/Config.java
@@ -49,6 +49,7 @@ public class Config {
private static final Pattern ENV_REPLACEMENT = Pattern.compile("[^a-zA-Z0-9_]");
public static final String CONFIGURATION_FILE = "trace.config";
+ public static final String SITE = "site";
public static final String SERVICE_NAME = "service.name";
public static final String TRACE_ENABLED = "trace.enabled";
public static final String INTEGRATIONS_ENABLED = "integrations.enabled";
@@ -109,7 +110,6 @@ public class Config {
public static final String LOGS_INJECTION_ENABLED = "logs.injection";
public static final String PROFILING_ENABLED = "profiling.enabled";
- public static final String PROFILING_SITE = "profiling.site";
public static final String PROFILING_URL = "profiling.url";
public static final String PROFILING_API_KEY = "profiling.api-key";
@@ -138,6 +138,7 @@ public class Config {
public static final String LANGUAGE_TAG_KEY = "language";
public static final String LANGUAGE_TAG_VALUE = "jvm";
+ public static final String DEFAULT_SITE = "datadoghq.com";
public static final String DEFAULT_SERVICE_NAME = "unnamed-java-app";
private static final boolean DEFAULT_TRACE_ENABLED = true;
@@ -177,7 +178,6 @@ public class Config {
public static final boolean DEFAULT_LOGS_INJECTION_ENABLED = false;
public static final boolean DEFAULT_PROFILING_ENABLED = false;
- public static final String DEFAULT_PROFILING_SITE = "datadoghq.com";
public static final int DEFAULT_PROFILING_START_DELAY = 10;
public static final boolean DEFAULT_PROFILING_START_FORCE_FIRST = false;
public static final int DEFAULT_PROFILING_UPLOAD_PERIOD = 60; // 1 min
@@ -211,6 +211,12 @@ public class Config {
*/
@Getter private final String runtimeId;
+ /**
+ * Note: this has effect only on profiling site. Traces are sent to Datadog agent and are not
+ * affected by this setting.
+ */
+ @Getter private final String site;
+
@Getter private final String serviceName;
@Getter private final boolean traceEnabled;
@Getter private final boolean integrationsEnabled;
@@ -272,7 +278,6 @@ public class Config {
@Getter private final Double traceRateLimit;
@Getter private final boolean profilingEnabled;
- @Getter private final String profilingSite;
private final String profilingUrl;
@Getter private final String profilingApiKey;
private final Map<String, String> profilingTags;
@@ -297,6 +302,7 @@ public class Config {
runtimeId = UUID.randomUUID().toString();
+ site = getSettingFromEnvironment(SITE, DEFAULT_SITE);
serviceName = getSettingFromEnvironment(SERVICE_NAME, DEFAULT_SERVICE_NAME);
traceEnabled = getBooleanSettingFromEnvironment(TRACE_ENABLED, DEFAULT_TRACE_ENABLED);
@@ -419,7 +425,6 @@ public class Config {
profilingEnabled =
getBooleanSettingFromEnvironment(PROFILING_ENABLED, DEFAULT_PROFILING_ENABLED);
- profilingSite = getSettingFromEnvironment(PROFILING_SITE, DEFAULT_PROFILING_SITE);
profilingUrl = getSettingFromEnvironment(PROFILING_URL, null);
// Note: We do not want APiKey to be loaded from property for security reasons
// Note: we do not use defined default here
@@ -483,6 +488,7 @@ public class Config {
private Config(final Properties properties, final Config parent) {
runtimeId = parent.runtimeId;
+ site = properties.getProperty(SITE, parent.site);
serviceName = properties.getProperty(SERVICE_NAME, parent.serviceName);
traceEnabled = getPropertyBooleanValue(properties, TRACE_ENABLED, parent.traceEnabled);
@@ -614,7 +620,6 @@ public class Config {
profilingEnabled =
getPropertyBooleanValue(properties, PROFILING_ENABLED, parent.profilingEnabled);
- profilingSite = properties.getProperty(PROFILING_SITE, parent.profilingSite);
profilingUrl = properties.getProperty(PROFILING_URL, parent.profilingUrl);
profilingApiKey = properties.getProperty(PROFILING_API_KEY, parent.profilingApiKey);
profilingTags = getPropertyMapValue(properties, PROFILING_TAGS, parent.profilingTags);
@@ -742,7 +747,7 @@ public class Config {
public String getFinalProfilingUrl() {
if (profilingUrl == null) {
- return String.format(PROFILING_URL_TEMPLATE, profilingSite);
+ return String.format(PROFILING_URL_TEMPLATE, site);
} else {
return profilingUrl;
}

MODIFY
dd-trace-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy
dd-trace-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy
@@ -40,7 +40,6 @@ import static datadog.trace.api.Config.PROFILING_PROXY_HOST
import static datadog.trace.api.Config.PROFILING_PROXY_PASSWORD
import static datadog.trace.api.Config.PROFILING_PROXY_PORT
import static datadog.trace.api.Config.PROFILING_PROXY_USERNAME
-import static datadog.trace.api.Config.PROFILING_SITE
import static datadog.trace.api.Config.PROFILING_START_DELAY
import static datadog.trace.api.Config.PROFILING_START_FORCE_FIRST
import static datadog.trace.api.Config.PROFILING_TAGS
@@ -56,6 +55,7 @@ import static datadog.trace.api.Config.RUNTIME_ID_TAG
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.SITE
import static datadog.trace.api.Config.SPAN_TAGS
import static datadog.trace.api.Config.SPLIT_BY_TAGS
import static datadog.trace.api.Config.TAGS
@@ -134,7 +134,7 @@ class ConfigTest extends DDSpecification {
config.healthMetricsStatsdPort == null
config.profilingEnabled == false
- config.profilingSite == Config.DEFAULT_PROFILING_SITE
+ config.site == Config.DEFAULT_SITE
config.profilingUrl == null
config.profilingApiKey == null
config.mergedProfilingTags == [(HOST_TAG): config.getHostName(), (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_TAG): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
@@ -200,7 +200,7 @@ class ConfigTest extends DDSpecification {
prop.setProperty(TRACE_RATE_LIMIT, "200")
prop.setProperty(PROFILING_ENABLED, "true")
- prop.setProperty(PROFILING_SITE, "new site")
+ prop.setProperty(SITE, "new site")
prop.setProperty(PROFILING_URL, "new url")
prop.setProperty(PROFILING_API_KEY, "new api key")
prop.setProperty(PROFILING_TAGS, "f:6,host:test-host")
@@ -257,7 +257,7 @@ class ConfigTest extends DDSpecification {
config.traceRateLimit == 200
config.profilingEnabled == true
- config.profilingSite == "new site"
+ config.site == "new site"
config.profilingUrl == "new url"
config.profilingApiKey == "new api key" // we can still override via internal properties object
config.mergedProfilingTags == [b: "2", f: "6", (HOST_TAG): "test-host", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_TAG): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
@@ -314,7 +314,7 @@ class ConfigTest extends DDSpecification {
System.setProperty(PREFIX + TRACE_RATE_LIMIT, "200")
System.setProperty(PREFIX + PROFILING_ENABLED, "true")
- System.setProperty(PREFIX + PROFILING_SITE, "new site")
+ System.setProperty(PREFIX + SITE, "new site")
System.setProperty(PREFIX + PROFILING_URL, "new url")
System.setProperty(PREFIX + PROFILING_API_KEY, "new api key")
System.setProperty(PREFIX + PROFILING_TAGS, "f:6,host:test-host")
@@ -371,7 +371,7 @@ class ConfigTest extends DDSpecification {
config.traceRateLimit == 200
config.profilingEnabled == true
- config.profilingSite == "new site"
+ config.site == "new site"
config.profilingUrl == "new url"
config.profilingApiKey == null // system properties cannot be used to provide a key
config.mergedProfilingTags == [b: "2", f: "6", (HOST_TAG): "test-host", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_TAG): config.serviceName, (LANGUAGE_TAG_KEY): LANGUAGE_TAG_VALUE]
@@ -1115,7 +1115,7 @@ class ConfigTest extends DDSpecification {
def "custom datadog site"() {
setup:
def prop = new Properties()
- prop.setProperty(PROFILING_SITE, "some.new.site")
+ prop.setProperty(SITE, "some.new.site")
when:
Config config = Config.get(prop)
@@ -1127,7 +1127,7 @@ class ConfigTest extends DDSpecification {
def "custom profiling url override"() {
setup:
def prop = new Properties()
- prop.setProperty(PROFILING_SITE, "some.new.site")
+ prop.setProperty(SITE, "some.new.site")
prop.setProperty(PROFILING_URL, "https://some.new.url/goes/here")
when:

Rename DD_PROFILING_SITE to DD_SITE