Skip to content

Commit

Permalink
Map OpenTelemetry environment variables and system properties to thei…
Browse files Browse the repository at this point in the history
…r Datadog equivalents
  • Loading branch information
mcculls committed Jun 13, 2024
1 parent 8085070 commit 0d6eb3f
Show file tree
Hide file tree
Showing 5 changed files with 640 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,9 @@ private static void configureLogger() {
logLevel = "DEBUG";
} else {
logLevel = ddGetProperty("dd.log.level");
if (null == logLevel) {
logLevel = System.getenv("OTEL_LOG_LEVEL");
}
}

if (null == logLevel && !isFeatureEnabled(AgentFeature.STARTUP_LOGS)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public final class ConfigDefaults {

static final boolean DEFAULT_SPAN_ORIGIN_ENABLED = false;
static final boolean DEFAULT_TRACE_ENABLED = true;
static final boolean DEFAULT_TRACE_OTEL_ENABLED = false;
public static final boolean DEFAULT_TRACE_OTEL_ENABLED = false;
static final boolean DEFAULT_INTEGRATIONS_ENABLED = true;

static final boolean DEFAULT_RUNTIME_CONTEXT_FIELD_INJECTION = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,14 @@ public static ConfigProvider createDefault() {
return new ConfigProvider(
new SystemPropertiesConfigSource(),
new EnvironmentConfigSource(),
new OtelEnvironmentConfigSource(),
new CapturedEnvironmentConfigSource());
} else {
return new ConfigProvider(
new SystemPropertiesConfigSource(),
new EnvironmentConfigSource(),
new PropertiesConfigSource(configProperties, true),
new OtelEnvironmentConfigSource(),
new CapturedEnvironmentConfigSource());
}
}
Expand All @@ -377,13 +379,15 @@ public static ConfigProvider withoutCollector() {
false,
new SystemPropertiesConfigSource(),
new EnvironmentConfigSource(),
new OtelEnvironmentConfigSource(),
new CapturedEnvironmentConfigSource());
} else {
return new ConfigProvider(
false,
new SystemPropertiesConfigSource(),
new EnvironmentConfigSource(),
new PropertiesConfigSource(configProperties, true),
new OtelEnvironmentConfigSource(),
new CapturedEnvironmentConfigSource());
}
}
Expand All @@ -401,13 +405,15 @@ public static ConfigProvider withPropertiesOverride(Properties properties) {
new SystemPropertiesConfigSource(),
new EnvironmentConfigSource(),
providedConfigSource,
new OtelEnvironmentConfigSource(),
new CapturedEnvironmentConfigSource());
} else {
return new ConfigProvider(
providedConfigSource,
new SystemPropertiesConfigSource(),
new EnvironmentConfigSource(),
new PropertiesConfigSource(configProperties, true),
new OtelEnvironmentConfigSource(),
new CapturedEnvironmentConfigSource());
}
}
Expand Down
Loading

0 comments on commit 0d6eb3f

Please sign in to comment.