Skip to content

serverless-init: enable Remote Config support#51518

Draft
jchrostek-dd wants to merge 1 commit into
mainfrom
john/serverless-init-rc-support
Draft

serverless-init: enable Remote Config support#51518
jchrostek-dd wants to merge 1 commit into
mainfrom
john/serverless-init-rc-support

Conversation

@jchrostek-dd
Copy link
Copy Markdown
Contributor

What does this PR do?

Enables Remote Config in cmd/serverless-init/ behind an opt-in preview flag:

  • Removes the hard-coded DD_REMOTE_CONFIGURATION_ENABLED=false and DD_INSTRUMENTATION_TELEMETRY_ENABLED=false env defaults from mode/mode.go — these were preventing RC and Live Debugger from working even when customers explicitly wanted them.
  • Adds setupRemoteConfig() in main.go that instantiates a pkg/config/remote/service.CoreAgentService and wires it into the trace agent via trace.StartServerlessTraceAgentArgs.RCService, making the trace agent's /v0.7/config endpoint a real RC proxy for in-process tracers.
  • Gates the RC service behind DD_REMOTE_CONFIGURATION_ENABLED_SERVERLESS_PREVIEW=true (default false) so customers must explicitly opt in. The config key is registered in pkg/config/setup/common_settings.go with a helper in pkg/config/utils/miscellaneous.go.
  • Uses a noopRcTelemetryReporter since comp/core/telemetry is 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 any defaultProfiles.yaml profile).
  • RC service is properly stopped in run() shutdown sequence after traceAgent.Stop() so in-flight /v0.7/config requests 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:

  1. The binary hard-disabled RC and tracer instrumentation telemetry at startup.
  2. The trace agent's /v0.7/config proxy 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 showed NO_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 with dd-trace-dotnet 3.x.

Confirmed:

  • Remote Config service started in container logs.
  • Tracer registers RC products including LIVE_DEBUGGING and LIVE_DEBUGGING_SYMBOL_DB.
  • Live Debugger probe on Classify() method flips WAITING → ACTIVE — 1/1 instances instrumented successfully.
  • Snapshots stream into Live Debugger sessions within ~60s.
  • service-context API reports correct agent_version and all three enablement_capabilities as supported: 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=true alongside the existing required vars (DD_API_KEY, DD_DYNAMIC_INSTRUMENTATION_ENABLED=true, DD_LOGS_ENABLED=true).

No new module dependencies. pkg/config/remote/service and pkg/version are already transitively reachable. Binary size delta: +20 KB (~0.03%).

🤖 Generated with Claude Code

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>
@github-actions
Copy link
Copy Markdown
Contributor

@codex review

@dd-octo-sts dd-octo-sts Bot added internal Identify a non-fork PR team/agent-configuration labels May 29, 2026
@github-actions github-actions Bot added the medium review PR review might take time label May 29, 2026
@datadog-prod-us1-3
Copy link
Copy Markdown
Contributor

datadog-prod-us1-3 Bot commented May 29, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

Label analysis | release-note-check   View in Datadog   GitHub Actions

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. No release note found for this PR. Please add one using 'reno' or apply the label 'changelog/no-changelog'.

Label analysis | skip-qa-check   View in Datadog   GitHub Actions

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. Missing required QA label for the pull request.

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 28.85%
Overall Coverage: 50.42% (-0.01%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ce5f7e1 | Docs | Datadog PR Page | Give us feedback!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +119 to +125
defer func() {
if rcService != nil {
if err := rcService.Stop(); err != nil {
log.Warnf("Error stopping Remote Config service: %v", err)
}
}
}()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 29, 2026

Files inventory check summary

File checks results against ancestor 6905f20e:

Results for datadog-agent_7.81.0~devel.git.324.ce5f7e1.pipeline.115985831-1_amd64.deb:

No change detected

@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 29, 2026

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor 6905f20
📊 Static Quality Gates Dashboard
🔗 SQG Job

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_msi +2.0 KiB (0.00% increase, -0.01% of buffer) 610.144 → 610.146 → 624.040
iot_agent_deb_amd64 +4.0 KiB (0.01% increase, -0.51% of buffer) 44.460 → 44.464 → 45.230
iot_agent_rpm_amd64 +4.0 KiB (0.01% increase, -0.51% of buffer) 44.461 → 44.465 → 45.230
iot_agent_suse_amd64 +4.0 KiB (0.01% increase, -0.51% of buffer) 44.461 → 44.465 → 45.230
29 successful checks with minimal change (< 2 KiB)
Quality gate Current Size
agent_deb_amd64 746.191 MiB
agent_deb_amd64_fips 703.965 MiB
agent_heroku_amd64 310.715 MiB
agent_rpm_amd64 746.174 MiB
agent_rpm_amd64_fips 703.949 MiB
agent_rpm_arm64 723.743 MiB
agent_rpm_arm64_fips 684.670 MiB
agent_suse_amd64 746.174 MiB
agent_suse_amd64_fips 703.949 MiB
agent_suse_arm64 723.743 MiB
agent_suse_arm64_fips 684.670 MiB
docker_agent_amd64 806.343 MiB
docker_agent_arm64 808.720 MiB
docker_agent_jmx_amd64 997.263 MiB
docker_agent_jmx_arm64 988.419 MiB
docker_cluster_agent_amd64 207.101 MiB
docker_cluster_agent_arm64 221.078 MiB
docker_cws_instrumentation_amd64 7.154 MiB
docker_cws_instrumentation_arm64 6.689 MiB
docker_dogstatsd_amd64 39.511 MiB
docker_dogstatsd_arm64 37.690 MiB
docker_host_profiler_amd64 302.123 MiB
docker_host_profiler_arm64 313.592 MiB
dogstatsd_deb_amd64 30.166 MiB
dogstatsd_deb_arm64 28.292 MiB
dogstatsd_rpm_amd64 30.166 MiB
dogstatsd_suse_amd64 30.166 MiB
iot_agent_deb_arm64 41.429 MiB
iot_agent_deb_armhf 42.146 MiB

@cit-pr-commenter-54b7da
Copy link
Copy Markdown

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: abf0c5e2-d32b-43b4-b06c-e723a9c2cbf0

Baseline: 6905f20
Comparison: ce5f7e1
Diff

❌ Experiments with retried target crashes

This 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.

  • quality_gate_idle

Optimization Goals: ✅ No significant changes detected

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

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:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. 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.

  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Identify a non-fork PR medium review PR review might take time team/agent-configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant