serverless-init: enable Remote Config support#51518
Conversation
Drop DD_REMOTE_CONFIGURATION_ENABLED=false and DD_INSTRUMENTATION_TELEMETRY_ENABLED=false from the init/sidecar env defaults, and wire a remoteconfig.CoreAgentService into the trace agent so its /v0.7/config proxy serves in-process tracers (e.g. dd-trace running under serverless-init in init mode). The telemetry default also gates Live Debugger probe-matching: the backend's live-service-instances list is populated from tracer instrumentation telemetry, so probes fail with "No instances match the probe instance selection" until telemetry can flow. Uses a no-op RcTelemetryReporter; the agent's full telemetry component is disabled on serverless builds (//go:build !serverless). The new comment in main.go documents the six metrics being skipped and the upgrade path if they become desirable. Validated locally: probes set in the Datadog UI for a wrapped dd-trace-py 4.8.7 sample app install on the tracer and stream snapshots into Live Debugger sessions. No new module dependencies. Binary delta ~20 KB. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce5f7e12ab
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| defer func() { | ||
| if rcService != nil { | ||
| if err := rcService.Stop(); err != nil { | ||
| log.Warnf("Error stopping Remote Config service: %v", err) | ||
| } | ||
| } | ||
| }() |
There was a problem hiding this comment.
Keep RC alive until the trace receiver stops
When serverless Remote Config is enabled, this defer order stops rcService before tracingCtx.TraceAgent.Stop() because defers run LIFO. The trace agent is the component that owns the /v0.7/config HTTP handler, and its Stop() first shuts down the receiver and waits for in-flight requests; closing the RC service (including its Uptane DB) before that leaves a window during shutdown where active config requests can run against a stopped service. Register the RC stop defer before the trace-agent stop defer so the trace receiver drains before RC is closed.
Useful? React with 👍 / 👎.
Files inventory check summaryFile checks results against ancestor 6905f20e: Results for datadog-agent_7.81.0~devel.git.324.ce5f7e1.pipeline.115985831-1_amd64.deb:No change detected |
Static quality checks✅ Please find below the results from static quality gates Successful checksInfo
29 successful checks with minimal change (< 2 KiB)
|
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: 6905f20 ❌ Experiments with retried target crashesThis is a critical error. One or more replicates failed with a non-zero exit code. These replicates may have been retried. See Replicate Execution Details for more information.
Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | -3.98 | [-6.85, -1.11] | 1 | Logs |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | quality_gate_idle_all_features | memory utilization | +0.63 | [+0.60, +0.67] | 1 | Logs bounds checks dashboard |
| ➖ | tcp_syslog_to_blackhole | ingress throughput | +0.63 | [+0.43, +0.83] | 1 | Logs |
| ➖ | ddot_metrics | memory utilization | +0.36 | [+0.16, +0.56] | 1 | Logs |
| ➖ | quality_gate_metrics_logs | memory utilization | +0.32 | [+0.07, +0.57] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle | memory utilization | +0.18 | [+0.13, +0.23] | 1 | Logs bounds checks dashboard |
| ➖ | docker_containers_memory | memory utilization | +0.11 | [+0.02, +0.21] | 1 | Logs |
| ➖ | otlp_ingest_logs | memory utilization | +0.11 | [+0.00, +0.21] | 1 | Logs |
| ➖ | file_to_blackhole_500ms_latency | egress throughput | +0.04 | [-0.36, +0.45] | 1 | Logs |
| ➖ | file_to_blackhole_100ms_latency | egress throughput | +0.03 | [-0.12, +0.19] | 1 | Logs |
| ➖ | uds_dogstatsd_20mb_12k_contexts_20_senders | memory utilization | +0.03 | [-0.02, +0.08] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api_v3 | ingress throughput | +0.02 | [-0.18, +0.22] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulativetodelta_exporter | memory utilization | +0.01 | [-0.23, +0.24] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api | ingress throughput | +0.00 | [-0.20, +0.20] | 1 | Logs |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.01 | [-0.13, +0.10] | 1 | Logs |
| ➖ | otlp_ingest_metrics | memory utilization | -0.04 | [-0.20, +0.12] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulative | memory utilization | -0.05 | [-0.20, +0.11] | 1 | Logs |
| ➖ | file_tree | memory utilization | -0.05 | [-0.09, -0.01] | 1 | Logs |
| ➖ | file_to_blackhole_1000ms_latency | egress throughput | -0.07 | [-0.52, +0.37] | 1 | Logs |
| ➖ | file_to_blackhole_0ms_latency | egress throughput | -0.08 | [-0.59, +0.43] | 1 | Logs |
| ➖ | ddot_metrics_sum_delta | memory utilization | -0.11 | [-0.32, +0.09] | 1 | Logs |
| ➖ | ddot_logs | memory utilization | -0.34 | [-0.41, -0.27] | 1 | Logs |
| ➖ | quality_gate_logs | % cpu utilization | -1.45 | [-2.47, -0.44] | 1 | Logs bounds checks dashboard |
| ➖ | docker_containers_cpu | % cpu utilization | -3.98 | [-6.85, -1.11] | 1 | Logs |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|---|---|---|---|---|---|
| ✅ | docker_containers_cpu | simple_check_run | 10/10 | 704 ≥ 26 | |
| ✅ | docker_containers_memory | memory_usage | 10/10 | 245.96MiB ≤ 370MiB | |
| ✅ | docker_containers_memory | simple_check_run | 10/10 | 679 ≥ 26 | |
| ✅ | file_to_blackhole_0ms_latency | memory_usage | 10/10 | 0.16GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_0ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_1000ms_latency | memory_usage | 10/10 | 0.20GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_1000ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_100ms_latency | memory_usage | 10/10 | 0.17GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_100ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_500ms_latency | memory_usage | 10/10 | 0.18GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_500ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | quality_gate_idle | intake_connections | 10/10 | 3 ≤ 4 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 143.39MiB ≤ 147MiB | bounds checks dashboard |
| ✅ | quality_gate_idle | total_bytes_received | 10/10 | 740.47KiB ≤ 819.20KiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 3 ≤ 4 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 478.37MiB ≤ 495MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | total_bytes_received | 10/10 | 1.13MiB ≤ 1.25MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 4 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 176.26MiB ≤ 195MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_logs | total_bytes_received | 10/10 | 264.31MiB ≤ 292MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 350.57 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 4 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 377.54MiB ≤ 430MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | total_bytes_received | 10/10 | 0.94GiB ≤ 1.04GiB | bounds checks dashboard |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
Replicate Execution Details
We run multiple replicates for each experiment/variant. However, we allow replicates to be automatically retried if there are any failures, up to 8 times, at which point the replicate is marked dead and we are unable to run analysis for the entire experiment. We call each of these attempts at running replicates a replicate execution. This section lists all replicate executions that failed due to the target crashing or being oom killed.
Note: In the below tables we bucket failures by experiment, variant, and failure type. For each of these buckets we list out the replicate indexes that failed with an annotation signifying how many times said replicate failed with the given failure mode. In the below example the baseline variant of the experiment named experiment_with_failures had two replicates that failed by oom kills. Replicate 0, which failed 8 executions, and replicate 1 which failed 6 executions, all with the same failure mode.
| Experiment | Variant | Replicates | Failure | Logs | Debug Dashboard |
|---|---|---|---|---|---|
| experiment_with_failures | baseline | 0 (x8) 1 (x6) | Oom killed | Debug Dashboard |
The debug dashboard links will take you to a debugging dashboard specifically designed to investigate replicate execution failures.
❌ Retried Normal Replicate Execution Failures (non-profiling)
| Experiment | Variant | Replicates | Failure | Debug Dashboard |
|---|---|---|---|---|
| quality_gate_idle | comparison | 1 | Oom killed | Debug Dashboard |
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
What does this PR do?
Enables Remote Config in
cmd/serverless-init/behind an opt-in preview flag:DD_REMOTE_CONFIGURATION_ENABLED=falseandDD_INSTRUMENTATION_TELEMETRY_ENABLED=falseenv defaults frommode/mode.go— these were preventing RC and Live Debugger from working even when customers explicitly wanted them.setupRemoteConfig()inmain.gothat instantiates apkg/config/remote/service.CoreAgentServiceand wires it into the trace agent viatrace.StartServerlessTraceAgentArgs.RCService, making the trace agent's/v0.7/configendpoint a real RC proxy for in-process tracers.DD_REMOTE_CONFIGURATION_ENABLED_SERVERLESS_PREVIEW=true(defaultfalse) so customers must explicitly opt in. The config key is registered inpkg/config/setup/common_settings.gowith a helper inpkg/config/utils/miscellaneous.go.noopRcTelemetryReportersincecomp/core/telemetryis disabled on serverless builds (//go:build !serverless). Investigation confirmed all 6 skipped metrics are Datadog-internal fleet telemetry that aren't forwarded anywhere even in full agent deployments (not in anydefaultProfiles.yamlprofile).run()shutdown sequence aftertraceAgent.Stop()so in-flight/v0.7/configrequests can drain first.Motivation
Customers using serverless-init on Azure Container Apps, GCP Cloud Run, and Lambda currently can't use Remote Config or Live Debugger because:
/v0.7/configproxy had no backing RC service.The instrumentation telemetry default was the subtler half: Live Debugger's backend matches probes against
live-service-instances, populated from tracer telemetry. With telemetry off, every probe showedNO_AGENTS — No instances match the probe instance selection.Describe how you validated your changes
Built
cmd/serverless-init/and ran it on Azure Container Apps (Consumption profile,dd-agent-azure-serverless-init-rg) wrapping a .NET 8 ASP.NET Core minimal API withdd-trace-dotnet3.x.Confirmed:
Remote Config service startedin container logs.LIVE_DEBUGGINGandLIVE_DEBUGGING_SYMBOL_DB.Classify()method flipsWAITING → ACTIVE — 1/1 instances instrumented successfully.service-contextAPI reports correctagent_versionand all threeenablement_capabilitiesassupported: true.Previously validated end-to-end with dd-trace-py 4.8.7 on the same infrastructure (sibling task
azure-serverless-init).Additional Notes
To opt in: set
DD_REMOTE_CONFIGURATION_ENABLED_SERVERLESS_PREVIEW=truealongside the existing required vars (DD_API_KEY,DD_DYNAMIC_INSTRUMENTATION_ENABLED=true,DD_LOGS_ENABLED=true).No new module dependencies.
pkg/config/remote/serviceandpkg/versionare already transitively reachable. Binary size delta: +20 KB (~0.03%).🤖 Generated with Claude Code