Skip to content

Commit 0850eaf

Browse files
bm1549claudebwoebi
authored
feat(tracing): report OTLP telemetry export status in startup log (#4056)
Add otlp_traces_export_enabled, otlp_metrics_export_enabled, and otlp_logs_export_enabled to the "DATADOG TRACER CONFIGURATION" startup diagnostic log, matching the shared cross-language schema. PHP exports traces natively via the Datadog Agent (never over OTLP), so otlp_traces_export_enabled is always false. The metrics and logs flags reflect the existing DD_METRICS_OTEL_ENABLED / DD_LOGS_OTEL_ENABLED configs -- the same request-scoped values the userland OpenTelemetry resolver consults -- so the log matches actual export behavior. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Bob Weinand <bob.weinand@datadoghq.com>
1 parent 42e54f9 commit 0850eaf

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

tests/ext/startup_logging.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ enabled_from_env: true
5353
opcache.file_cache: null
5454
dynamic_instrumentation_enabled: false
5555
exception_replay_enabled: false
56+
otlp_traces_export_enabled: false
57+
otlp_metrics_export_enabled: false
58+
otlp_logs_export_enabled: false
5659
loaded_by_ssi: false

tests/ext/startup_logging_config.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ $env = [
2727
'DD_TRACE_REPORT_HOSTNAME' => '1',
2828
'DD_TRACE_TRACED_INTERNAL_FUNCTIONS' => 'array_sum,mt_rand,DateTime::add',
2929
'DD_TRACE_ENABLED' => '1',
30+
'DD_METRICS_OTEL_ENABLED' => '1',
31+
'DD_LOGS_OTEL_ENABLED' => '1',
3032
];
3133
$logs = dd_get_startup_logs($ini, $env);
3234

@@ -53,6 +55,9 @@ dd_dump_startup_logs($logs, [
5355
'report_hostname_on_root_span',
5456
'traced_internal_functions',
5557
'enabled_from_env',
58+
'otlp_traces_export_enabled',
59+
'otlp_metrics_export_enabled',
60+
'otlp_logs_export_enabled',
5661
]);
5762
?>
5863
--EXPECT--
@@ -76,3 +81,6 @@ measure_compile_time: false
7681
report_hostname_on_root_span: true
7782
traced_internal_functions: "array_sum,mt_rand,DateTime::add"
7883
enabled_from_env: true
84+
otlp_traces_export_enabled: false
85+
otlp_metrics_export_enabled: true
86+
otlp_logs_export_enabled: true

tests/ext/startup_logging_json.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@ enabled_from_env: true
5454
opcache.file_cache: null
5555
dynamic_instrumentation_enabled: false
5656
exception_replay_enabled: false
57+
otlp_traces_export_enabled: false
58+
otlp_metrics_export_enabled: false
59+
otlp_logs_export_enabled: false
5760
loaded_by_ssi: false
5861
datadog.trace.sources_path_reachable: false

tracer/tracer_startup_logging.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ void ddtrace_populate_startup_config(HashTable *ht) {
6060
dd_add_assoc_bool(ht, ZEND_STRL("sidecar_trace_sender"), get_global_DD_TRACE_SIDECAR_TRACE_SENDER());
6161
dd_add_assoc_bool(ht, ZEND_STRL("dynamic_instrumentation_enabled"), get_global_DD_DYNAMIC_INSTRUMENTATION_ENABLED());
6262
dd_add_assoc_bool(ht, ZEND_STRL("exception_replay_enabled"), get_global_DD_EXCEPTION_REPLAY_ENABLED());
63+
64+
// OTLP telemetry export status (cross-language schema). PHP exports traces natively via the
65+
// Datadog Agent (never over OTLP), so otlp_traces_export_enabled is always false; the metrics
66+
// and logs flags mirror DD_METRICS_OTEL_ENABLED / DD_LOGS_OTEL_ENABLED (request-scoped).
67+
dd_add_assoc_bool(ht, ZEND_STRL("otlp_traces_export_enabled"), false);
68+
dd_add_assoc_bool(ht, ZEND_STRL("otlp_metrics_export_enabled"), get_DD_METRICS_OTEL_ENABLED());
69+
dd_add_assoc_bool(ht, ZEND_STRL("otlp_logs_export_enabled"), get_DD_LOGS_OTEL_ENABLED());
6370
}
6471

6572
static bool dd_file_exists(const char *file) {

0 commit comments

Comments
 (0)