Skip to content
Draft
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
4 changes: 2 additions & 2 deletions ext/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ enum datadog_sidecar_connection_mode {
CONFIG(STRING, DD_AGENT_HOST, "localhost", .ini_change = zai_config_system_ini_change) \
CONFIG(STRING, DD_DOGSTATSD_URL, "http://localhost:8125") \
CONFIG(STRING, DD_DOGSTATSD_HOST, "localhost") \
CONFIG(STRING, DD_API_KEY, "", .ini_change = zai_config_system_ini_change) \
CONFIG(STRING, DD_API_KEY, "", .ini_change = zai_config_system_ini_change, .sensitive = true) \
CONFIG(INT, DD_DOGSTATSD_PORT, "8125") \
CONFIG(STRING, DD_ENV, "", .ini_change = datadog_alter_dd_env, \
.env_config_fallback = ddtrace_conf_otel_resource_attributes_env) \
Expand All @@ -59,7 +59,7 @@ enum datadog_sidecar_connection_mode {
CONFIG(BOOL, DD_TRACE_CLI_ENABLED, "true") \
CONFIG(BOOL, DD_TRACE_DEBUG, "false", .ini_change = datadog_alter_dd_trace_debug) \
CONFIG(BOOL, DD_TRACE_ENABLED, "true", .ini_change = datadog_alter_dd_trace_disabled_config, \
.env_config_fallback = ddtrace_conf_otel_traces_exporter) \
.env_config_fallback = ddtrace_conf_otel_traces_exporter, .sensitive = true) \
CONFIG(BOOL, DD_INSTRUMENTATION_TELEMETRY_ENABLED, "true", .ini_change = zai_config_system_ini_change) \
CONFIG(BOOL, DD_TRACE_HEALTH_METRICS_ENABLED, "false", .ini_change = zai_config_system_ini_change) \
CONFIG(DOUBLE, DD_TRACE_HEALTH_METRICS_HEARTBEAT_SAMPLE_RATE, "0.001") \
Expand Down
3 changes: 1 addition & 2 deletions ext/telemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ void datadog_telemetry_finalize() {
#if ZTS
ini = zend_hash_find_ptr(EG(ini_directives), ini->name);
#endif
if (cfg->names[0].len != sizeof("DD_TRACE_ENABLED") - 1
|| memcmp(cfg->names[0].ptr, "DD_TRACE_ENABLED", sizeof("DD_TRACE_ENABLED") - 1) != 0) { // DD_TRACE_ENABLED is meaningless: always off at rshutdown
if (!cfg->sensitive) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While DD_TRACE_ENABLED isn't sensitive, it can be handled in the same way

ddog_ConfigurationOrigin origin = DDOG_CONFIGURATION_ORIGIN_ENV_VAR;
switch (cfg->name_index) {
case ZAI_CONFIG_ORIGIN_DEFAULT:
Expand Down
12 changes: 12 additions & 0 deletions loader/tests/functional/test_configuration_telemetry.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
'DD_INJECT_FORCE=true',
'DD_INJECTION_ENABLED=tracer', // Normally set by the injector
'DD_SERVICE=loader',
'DD_API_KEY=SENTINEL_DD_API_KEY',
'DD_VERSION=1.2.3-loader-test',
]);

assertMatchesFormat($output, '%A"loaded_by_ssi":true%s%A');
Expand All @@ -22,3 +24,13 @@
assertContains($content, '{"name":"instrumentation_source","value":"ssi","origin":"default","config_id":null,"seq_id":null}');
assertContains($content, '{"name":"ssi_injection_enabled","value":"tracer","origin":"env_var","config_id":null,"seq_id":null}');
assertContains($content, '{"name":"ssi_forced_injection_enabled","value":"True","origin":"env_var","config_id":null,"seq_id":null}');

// Sensitive configurations are excluded from configuration telemetry: neither
// the name nor the value is enqueued. DD_API_KEY and DD_TRACE_ENABLED carry the
// `sensitive` flag.
assertNotContains($content, 'SENTINEL_DD_API_KEY');
assertNotContains($content, '"name":"DD_API_KEY"');
assertNotContains($content, '"name":"DD_TRACE_ENABLED"');

// Non-sensitive configurations are still reported.
assertContains($content, '{"name":"DD_VERSION","value":"1.2.3-loader-test","origin":"env_var","config_id":null,"seq_id":null}');
6 changes: 4 additions & 2 deletions metadata/supported-configurations.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
{
"implementation": "C",
"type": "string",
"default": ""
"default": "",
"sensitive": true
}
],
"DD_API_SECURITY_ENABLED": [
Expand Down Expand Up @@ -1103,7 +1104,8 @@
{
"implementation": "A",
"type": "boolean",
"default": "true"
"default": "true",
"sensitive": true
}
],
"DD_TRACE_EXEC_ANALYTICS_ENABLED": [
Expand Down
2 changes: 2 additions & 0 deletions profiling/src/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ pub struct ZaiConfigEntry {
pub parser: zai_custom_parse,
pub displayer: zai_custom_display,
pub env_config_fallback: zai_env_config_fallback,
pub sensitive: bool,
}

#[repr(C)]
Expand All @@ -717,6 +718,7 @@ pub struct ZaiConfigMemoizedEntry {
pub parser: zai_custom_parse,
pub displayer: zai_custom_display,
pub env_config_fallback: zai_env_config_fallback,
pub sensitive: bool,
pub original_on_modify: Option<
unsafe extern "C" fn(
entry: *mut zend_ini_entry,
Expand Down
24 changes: 24 additions & 0 deletions profiling/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_profiling_enabled),
displayer: Some(display_profiling_enabled),
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingExperimentalFeaturesEnabled),
Expand All @@ -1031,6 +1032,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingEndpointCollectionEnabled),
Expand All @@ -1043,6 +1045,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingExperimentalCpuTimeEnabled),
Expand All @@ -1055,6 +1058,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingAllocationEnabled),
Expand All @@ -1067,6 +1071,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingAllocationSamplingDistance),
Expand All @@ -1079,6 +1084,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_sampling_distance_filter),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingExperimentalHeapLiveEnabled),
Expand All @@ -1091,6 +1097,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingTimelineEnabled),
Expand All @@ -1103,6 +1110,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingExceptionEnabled),
Expand All @@ -1115,6 +1123,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingExceptionMessageEnabled),
Expand All @@ -1127,6 +1136,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingExceptionSamplingDistance),
Expand All @@ -1139,6 +1149,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_sampling_distance_filter),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingExperimentalIOEnabled),
Expand All @@ -1151,6 +1162,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingLogLevel),
Expand All @@ -1163,6 +1175,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_level_filter),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(ProfilingOutputPprof),
Expand All @@ -1175,6 +1188,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
// At the moment, wall-time cannot be fully disabled. This only
// controls automatic collection (manual collection is still
Expand All @@ -1190,6 +1204,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(AgentHost),
Expand All @@ -1202,6 +1217,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(Env),
Expand All @@ -1214,6 +1230,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(Service),
Expand All @@ -1226,6 +1243,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(Tags),
Expand All @@ -1242,6 +1260,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: None,
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(TraceAgentPort),
Expand All @@ -1254,6 +1273,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(TraceAgentUrl),
Expand All @@ -1266,6 +1286,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(Version),
Expand All @@ -1278,6 +1299,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(GitCommitSha),
Expand All @@ -1290,6 +1312,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
zai_config_entry {
id: transmute::<ConfigId, u16>(GitRepositoryUrl),
Expand All @@ -1302,6 +1325,7 @@ pub(crate) fn minit(module_number: libc::c_int) {
parser: Some(parse_utf8_string),
displayer: None,
env_config_fallback: None,
sensitive: false,
},
]
};
Expand Down
6 changes: 3 additions & 3 deletions src/DDTrace/OpenTelemetry/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
'OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT',
'OTEL_EXPORTER_OTLP_ENDPOINT',
'OTEL_EXPORTER_OTLP_METRICS_HEADERS',
'OTEL_EXPORTER_OTLP_LOGS_HEADERS',
'OTEL_EXPORTER_OTLP_HEADERS',
// The OTLP header configurations (OTEL_EXPORTER_OTLP_HEADERS,
// OTEL_EXPORTER_OTLP_METRICS_HEADERS, OTEL_EXPORTER_OTLP_LOGS_HEADERS) are
// sensitive and intentionally not tracked for configuration telemetry.
'OTEL_EXPORTER_OTLP_METRICS_TIMEOUT',
'OTEL_EXPORTER_OTLP_LOGS_TIMEOUT',
'OTEL_EXPORTER_OTLP_TIMEOUT',
Expand Down
Loading
Loading