Skip to content

Commit

Permalink
Map OpenTelemetry environment variables to their Datadog equivalents (#…
Browse files Browse the repository at this point in the history
…7184)

* Check optional Datadog configuration file for Datadog properties
* Register OtelEnvironmentConfigSource with GraalVM for build-time
  • Loading branch information
mcculls committed Jun 13, 2024
1 parent 8085070 commit f482f2c
Show file tree
Hide file tree
Showing 6 changed files with 665 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 @@ -82,6 +82,7 @@ public static void onEnter(@Advice.Argument(value = 0, readOnly = false) String[
+ "datadog.trace.bootstrap.config.provider.ConfigConverter:build_time,"
+ "datadog.trace.bootstrap.config.provider.ConfigProvider:build_time,"
+ "datadog.trace.bootstrap.config.provider.ConfigProvider$Singleton:build_time,"
+ "datadog.trace.bootstrap.config.provider.OtelEnvironmentConfigSource:build_time,"
+ "datadog.trace.bootstrap.Agent:build_time,"
+ "datadog.trace.bootstrap.BootstrapProxy:build_time,"
+ "datadog.trace.bootstrap.CallDepthThreadLocalMap:build_time,"
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(configProperties),
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(configProperties),
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(configProperties),
new CapturedEnvironmentConfigSource());
}
}
Expand Down
Loading

0 comments on commit f482f2c

Please sign in to comment.