Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1213,13 +1213,13 @@ private static boolean isFeatureEnabled(AgentFeature feature) {
final String featureSystemProp = feature.getSystemProp();
String featureEnabled = System.getProperty(featureSystemProp);
if (featureEnabled == null) {
featureEnabled = getStableConfig(StableConfigSource.MANAGED, featureConfigKey);
featureEnabled = getStableConfig(StableConfigSource.FLEET, featureConfigKey);
}
if (featureEnabled == null) {
featureEnabled = ddGetEnv(featureSystemProp);
}
if (featureEnabled == null) {
featureEnabled = getStableConfig(StableConfigSource.USER, featureConfigKey);
featureEnabled = getStableConfig(StableConfigSource.LOCAL, featureConfigKey);
}

if (feature.isEnabledByDefault()) {
Expand All @@ -1243,13 +1243,13 @@ private static boolean isFullyDisabled(final AgentFeature feature) {
final String featureSystemProp = feature.getSystemProp();
String settingValue = getNullIfEmpty(System.getProperty(featureSystemProp));
if (settingValue == null) {
settingValue = getNullIfEmpty(getStableConfig(StableConfigSource.MANAGED, featureConfigKey));
settingValue = getNullIfEmpty(getStableConfig(StableConfigSource.FLEET, featureConfigKey));
}
if (settingValue == null) {
settingValue = getNullIfEmpty(ddGetEnv(featureSystemProp));
}
if (settingValue == null) {
settingValue = getNullIfEmpty(getStableConfig(StableConfigSource.USER, featureConfigKey));
settingValue = getNullIfEmpty(getStableConfig(StableConfigSource.LOCAL, featureConfigKey));
}

// defaults to inactive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public enum ConfigOrigin {
/** configurations that are set through JVM properties */
JVM_PROP("jvm_prop"),
/** configuration read in the stable config file, managed by users */
USER_STABLE_CONFIG("user_stable_config"),
LOCAL_STABLE_CONFIG("local_stable_config"),
/** configuration read in the stable config file, managed by fleet */
MANAGED_STABLE_CONFIG("managed_stable_config"),
FLEET_STABLE_CONFIG("fleet_stable_config"),
/** set when the user has not set any configuration for the key (defaults to a value) */
DEFAULT("default");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,19 @@ public static ConfigProvider createDefault() {
if (configProperties.isEmpty()) {
return new ConfigProvider(
new SystemPropertiesConfigSource(),
StableConfigSource.MANAGED,
StableConfigSource.FLEET,
new EnvironmentConfigSource(),
new OtelEnvironmentConfigSource(),
StableConfigSource.USER,
StableConfigSource.LOCAL,
new CapturedEnvironmentConfigSource());
} else {
return new ConfigProvider(
new SystemPropertiesConfigSource(),
StableConfigSource.MANAGED,
StableConfigSource.FLEET,
new EnvironmentConfigSource(),
new PropertiesConfigSource(configProperties, true),
new OtelEnvironmentConfigSource(configProperties),
StableConfigSource.USER,
StableConfigSource.LOCAL,
new CapturedEnvironmentConfigSource());
}
}
Expand All @@ -382,20 +382,20 @@ public static ConfigProvider withoutCollector() {
return new ConfigProvider(
false,
new SystemPropertiesConfigSource(),
StableConfigSource.MANAGED,
StableConfigSource.FLEET,
new EnvironmentConfigSource(),
new OtelEnvironmentConfigSource(),
StableConfigSource.USER,
StableConfigSource.LOCAL,
new CapturedEnvironmentConfigSource());
} else {
return new ConfigProvider(
false,
new SystemPropertiesConfigSource(),
StableConfigSource.MANAGED,
StableConfigSource.FLEET,
new EnvironmentConfigSource(),
new PropertiesConfigSource(configProperties, true),
new OtelEnvironmentConfigSource(configProperties),
StableConfigSource.USER,
StableConfigSource.LOCAL,
new CapturedEnvironmentConfigSource());
}
}
Expand All @@ -411,21 +411,21 @@ public static ConfigProvider withPropertiesOverride(Properties properties) {
if (configProperties.isEmpty()) {
return new ConfigProvider(
new SystemPropertiesConfigSource(),
StableConfigSource.MANAGED,
StableConfigSource.FLEET,
new EnvironmentConfigSource(),
providedConfigSource,
new OtelEnvironmentConfigSource(),
StableConfigSource.USER,
StableConfigSource.LOCAL,
new CapturedEnvironmentConfigSource());
} else {
return new ConfigProvider(
providedConfigSource,
new SystemPropertiesConfigSource(),
StableConfigSource.MANAGED,
StableConfigSource.FLEET,
new EnvironmentConfigSource(),
new PropertiesConfigSource(configProperties, true),
new OtelEnvironmentConfigSource(configProperties),
StableConfigSource.USER,
StableConfigSource.LOCAL,
new CapturedEnvironmentConfigSource());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
public final class StableConfigSource extends ConfigProvider.Source {
private static final Logger log = LoggerFactory.getLogger(StableConfigSource.class);

public static final String USER_STABLE_CONFIG_PATH =
public static final String LOCAL_STABLE_CONFIG_PATH =
"/etc/datadog-agent/application_monitoring.yaml";
public static final String MANAGED_STABLE_CONFIG_PATH =
public static final String FLEET_STABLE_CONFIG_PATH =
"/etc/datadog-agent/managed/datadog-agent/stable/application_monitoring.yaml";
public static final StableConfigSource USER =
new StableConfigSource(USER_STABLE_CONFIG_PATH, ConfigOrigin.USER_STABLE_CONFIG);
public static final StableConfigSource MANAGED =
public static final StableConfigSource LOCAL =
new StableConfigSource(LOCAL_STABLE_CONFIG_PATH, ConfigOrigin.LOCAL_STABLE_CONFIG);
public static final StableConfigSource FLEET =
new StableConfigSource(
StableConfigSource.MANAGED_STABLE_CONFIG_PATH, ConfigOrigin.MANAGED_STABLE_CONFIG);
StableConfigSource.FLEET_STABLE_CONFIG_PATH, ConfigOrigin.FLEET_STABLE_CONFIG);

private final ConfigOrigin fileOrigin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class StableConfigSourceTest extends DDSpecification {

def "test file doesn't exist"() {
setup:
StableConfigSource config = new StableConfigSource(StableConfigSource.USER_STABLE_CONFIG_PATH, ConfigOrigin.USER_STABLE_CONFIG)
StableConfigSource config = new StableConfigSource(StableConfigSource.LOCAL_STABLE_CONFIG_PATH, ConfigOrigin.LOCAL_STABLE_CONFIG)

expect:
config.getKeys().size() == 0
Expand All @@ -27,7 +27,7 @@ class StableConfigSourceTest extends DDSpecification {
if (filePath == null) {
throw new AssertionError("Failed to create test file")
}
StableConfigSource config = new StableConfigSource(filePath.toString(), ConfigOrigin.USER_STABLE_CONFIG)
StableConfigSource config = new StableConfigSource(filePath.toString(), ConfigOrigin.LOCAL_STABLE_CONFIG)

then:
config.getKeys().size() == 0
Expand All @@ -49,7 +49,7 @@ class StableConfigSourceTest extends DDSpecification {
throw new AssertionError("Failed to write to file: ${e.message}")
}

StableConfigSource cfg = new StableConfigSource(filePath.toString(), ConfigOrigin.USER_STABLE_CONFIG)
StableConfigSource cfg = new StableConfigSource(filePath.toString(), ConfigOrigin.LOCAL_STABLE_CONFIG)

then:
cfg.get("service") == "svc"
Expand All @@ -74,7 +74,7 @@ class StableConfigSourceTest extends DDSpecification {
throw new AssertionError("Failed to write to file: ${e.message}")
}

StableConfigSource stableCfg = new StableConfigSource(filePath.toString(), ConfigOrigin.USER_STABLE_CONFIG)
StableConfigSource stableCfg = new StableConfigSource(filePath.toString(), ConfigOrigin.LOCAL_STABLE_CONFIG)

then:
stableCfg.getConfigId() == null
Expand All @@ -100,7 +100,7 @@ class StableConfigSourceTest extends DDSpecification {
throw new AssertionError("Failed to write to file: ${e.message}")
}

StableConfigSource stableCfg = new StableConfigSource(filePath.toString(), ConfigOrigin.USER_STABLE_CONFIG)
StableConfigSource stableCfg = new StableConfigSource(filePath.toString(), ConfigOrigin.LOCAL_STABLE_CONFIG)

then:
for (key in configs.keySet()) {
Expand Down
Loading