Skip to content

fix(datadog-agent-commons): Survive health check network partition at boot - #2111

Merged
blt merged 1 commit into
mainfrom
blt/fix_core_agent_health_check_retry
Jul 14, 2026
Merged

fix(datadog-agent-commons): Survive health check network partition at boot#2111
blt merged 1 commit into
mainfrom
blt/fix_core_agent_health_check_retry

Conversation

@blt

@blt blt commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

At boot time ADP establishes a gRPC connection with core Agent. This
connection is done in multiple parts, remote agent registration,
hostname fetch, health check etc. Most of these are managed by
RemoteAgentClient and are retried, however, the health check is attempted
only once post-connection. This means that a network partition between
a successful connection and the health check terminates ADP.

This commit moves the health check into the same retry scheme as the
rest of the boot sequence.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

How did you test this PR?

References

REF SMPTNG-766

@pr-commenter

pr-commenter Bot commented Jul 14, 2026

Copy link
Copy Markdown

Binary Size Analysis (Agent Data Plane)

Baseline: f482d34 · Comparison: b4fe46c · diff
Analysis Configuration: stripped binaries · Pass/Fail Threshold: +5%
Sizes: 39.57 MiB (baseline) vs 39.53 MiB (comparison)
Size Change: -36.74 KiB (-0.09%)

✅ Binary size difference within threshold

Changes by Module
Module File Size Symbols
figment +33.29 KiB 41
core -26.74 KiB 1051
tonic +21.28 KiB 121
anon.b398c22209c592d66ca84ccf391d4d4f.430.llvm.16316498481591825302 +16.39 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.579.llvm.6237568490853829364 -16.39 KiB 1
http_body_util -13.19 KiB 37
tonic_prost +12.86 KiB 15
anon.b1460660eed7ea1a8338cc92a6f37715.359.llvm.16802098159553503863 +11.67 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.700.llvm.6237568490853829364 -11.67 KiB 1
http -11.60 KiB 35
prost -10.57 KiB 19
agent_data_plane::components::host_tags -10.32 KiB 2
anon.b398c22209c592d66ca84ccf391d4d4f.472.llvm.16316498481591825302 +9.45 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.209.llvm.6237568490853829364 -9.45 KiB 1
anon.b398c22209c592d66ca84ccf391d4d4f.399.llvm.16316498481591825302 +8.81 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.577.llvm.6237568490853829364 -8.80 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.3.llvm.6237568490853829364 -8.05 KiB 1
anon.b1460660eed7ea1a8338cc92a6f37715.0.llvm.16802098159553503863 +8.05 KiB 1
alloc +7.26 KiB 171
anon.b1460660eed7ea1a8338cc92a6f37715.166.llvm.16802098159553503863 +7.12 KiB 1
Detailed Symbol Changes
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [NEW] +23.0Ki  [NEW] +22.9Ki    agent_data_plane::state::metrics::rules::get_datadog_agent_remappings::he376f2e6ee57e93b
  [NEW] +16.4Ki  [NEW]     +76    anon.b398c22209c592d66ca84ccf391d4d4f.430.llvm.16316498481591825302
  [NEW] +14.8Ki  [NEW] +14.7Ki    agent_data_plane::state::metrics::rules::get_compat_remappings::hd88ef0b61e9b2357
  [NEW] +11.7Ki  [NEW]     +81    anon.b1460660eed7ea1a8338cc92a6f37715.359.llvm.16802098159553503863
   +56% +10.9Ki   +57% +10.9Ki    datadog_agent_commons::ipc::client::RemoteAgentClient::from_client_configuration::_{{closure}}::_{{closure}}::_{{closure}}::h6382944aa56001e7
  [NEW] +9.45Ki  [NEW]     +79    anon.b398c22209c592d66ca84ccf391d4d4f.472.llvm.16316498481591825302
  [NEW] +8.81Ki  [NEW]     +91    anon.b398c22209c592d66ca84ccf391d4d4f.399.llvm.16316498481591825302
  [NEW] +8.05Ki  [NEW]     +81    anon.b1460660eed7ea1a8338cc92a6f37715.0.llvm.16802098159553503863
  [NEW] +7.12Ki  [NEW]     +77    anon.b1460660eed7ea1a8338cc92a6f37715.166.llvm.16802098159553503863
  [NEW] +7.11Ki  [NEW] +7.03Ki    tokio::runtime::runtime::Runtime::block_on::hd36dde082a546da1
  [DEL] -7.03Ki  [DEL]     -77    anon.af97149b0445cad8a4012b595e0bd85e.42.llvm.6237568490853829364
  [DEL] -8.05Ki  [DEL]     -81    anon.af97149b0445cad8a4012b595e0bd85e.3.llvm.6237568490853829364
  [DEL] -8.80Ki  [DEL]     -91    anon.af97149b0445cad8a4012b595e0bd85e.577.llvm.6237568490853829364
  [DEL] -9.45Ki  [DEL]     -79    anon.af97149b0445cad8a4012b595e0bd85e.209.llvm.6237568490853829364
 -43.8% -10.4Ki -44.2% -10.4Ki    _<agent_data_plane::components::host_tags::HostTagsConfiguration as saluki_core::components::transforms::builder::SynchronousTransformBuilder>::build::_{{closure}}::hb62c4c6a8b36ac9f
 -80.6% -10.4Ki -81.5% -10.4Ki    datadog_agent_commons::ipc::client::RemoteAgentClient::from_configuration::_{{closure}}::h61a6073efa64f634
  [DEL] -10.9Ki  [DEL] -10.7Ki    agent_data_plane::state::metrics::rules::dogstatsd::get_dogstatsd_remappings::h73c968ff4f826543
  [DEL] -11.7Ki  [DEL]     -81    anon.af97149b0445cad8a4012b595e0bd85e.700.llvm.6237568490853829364
  [DEL] -14.2Ki  [DEL] -14.1Ki    agent_data_plane::state::metrics::rules::compat::get_compat_remappings::h57f2434e43736815
  [DEL] -16.4Ki  [DEL]     -76    anon.af97149b0445cad8a4012b595e0bd85e.579.llvm.6237568490853829364
  -0.9% -46.8Ki  -0.5% -21.9Ki    [5174 Others]
  -0.1% -36.7Ki  -0.0% -12.0Ki    TOTAL

@pr-commenter

pr-commenter Bot commented Jul 14, 2026

Copy link
Copy Markdown

Regression Detector (Agent Data Plane)

Run ID: 64b7b590-3870-4969-9cda-ceb5bee10a19
Baseline: 9581839e · Comparison: 4e6c19ce · diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment (5)

Experiments configured erratic: true are tagged (ignored) and skipped when determining which experiments regressed or improved. Experiments which are detected as erratic at runtime are tagged (erratic) to flag that the run's sample dispersion was high, but their regression / improvement signal still counts.

experiment goal Δ mean % links
quality_gates_rss_dsd_medium memory ⚪ +0.09 metrics profiles logs
quality_gates_rss_dsd_heavy memory ⚪ -0.15 metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory ⚪ -0.38 metrics profiles logs
quality_gates_rss_idle memory ⚪ -0.48 metrics profiles logs
quality_gates_rss_dsd_low memory ⚪ -0.63 metrics profiles logs
Bounds Checks: ✅ Passed (5)
experiment check replicates observed links
quality_gates_rss_dsd_heavy memory_usage 10/10 ✅ 134 MiB ≤ 140 MiB metrics profiles logs
quality_gates_rss_dsd_low memory_usage 10/10 ✅ 45.5 MiB ≤ 50 MiB metrics profiles logs
quality_gates_rss_dsd_medium memory_usage 10/10 ✅ 68.6 MiB ≤ 75 MiB metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 ✅ 194 MiB ≤ 200 MiB metrics profiles logs
quality_gates_rss_idle memory_usage 10/10 ✅ 31.7 MiB ≤ 40 MiB metrics profiles logs
Explanation

A change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression (is_regression: true). Improvements use the matching criteria for the improving direction. Experiments configured erratic: true (tagged (ignored)) are skipped outright; experiments detected as erratic at runtime (tagged (erratic)) still count, since that flag describes sample dispersion rather than directional certainty. The Δ mean % cell is colored accordingly: 🟢 = improvement, 🔴 = regression, ⚪ = neutral. Reduction in CPU or memory is an improvement; reduction in ingress throughput is a regression.

@blt
blt marked this pull request as ready for review July 14, 2026 15:33
@blt
blt requested a review from a team as a code owner July 14, 2026 15:34
Copilot AI review requested due to automatic review settings July 14, 2026 15:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

The PR correctly moves the health check into the retry block to handle transient network partitions at boot. The change is minimal and sound: it makes the health check retryable (up to 10 attempts with 2-second backoff) rather than a single attempt, fixing the specific bug where a network partition after TCP connect but before the health check RPC would terminate ADP. No behavioral regressions found.

Was this helpful? React 👍 or 👎

📊 Validated against 5 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit b04c5f8 · What is Autotest? · Any feedback? Reach out in #autotest

@blt
blt force-pushed the blt/chore_antithesis_tidy_up_sut_assertions branch from 5e60473 to 35f3d41 Compare July 14, 2026 15:42
Copilot AI review requested due to automatic review settings July 14, 2026 15:42
@blt
blt force-pushed the blt/fix_core_agent_health_check_retry branch from b04c5f8 to 7723112 Compare July 14, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@blt blt changed the title fix(datadog-agent-commons): Survive network partition at boot fix(datadog-agent-commons): Survive health check network partition at boot Jul 14, 2026
@blt
blt force-pushed the blt/chore_antithesis_tidy_up_sut_assertions branch from 35f3d41 to 5f369f8 Compare July 14, 2026 19:05
@blt
blt requested a review from a team as a code owner July 14, 2026 19:05
@blt
blt force-pushed the blt/fix_core_agent_health_check_retry branch from 7723112 to 4e6c19c Compare July 14, 2026 19:06

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

Copy link
Copy Markdown

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: 4e6c19ce36

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// this first RPC stream, so retrying here keeps a boot-time blip from failing client construction.
let mut secure_client =
AgentSecureClient::new(service.clone()).max_decoding_message_size(config.grpc_max_message_size());
try_query_agent_api(&mut secure_client).await?;

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 Avoid retrying permanent authentication failures

When this health check returns Code::Unauthenticated, try_query_agent_api converts it to a GenericError; because the call now runs inside service_builder.retry(config) with no retry predicate, a wrong token is retried for connect_retry_attempts with connect_retry_backoff sleeps before surfacing the same configuration error. In deployments with invalid credentials this delays startup by about 20s by default and logs misleading connection-retry warnings, so exclude unauthenticated health-check failures from this retry path.

Useful? React with 👍 / 👎.

@datadog-official

This comment has been minimized.

@blt
blt force-pushed the blt/chore_antithesis_tidy_up_sut_assertions branch 2 times, most recently from fdaee90 to 142ee6c Compare July 14, 2026 19:30
@blt
blt force-pushed the blt/fix_core_agent_health_check_retry branch from 4e6c19c to 31ccfef Compare July 14, 2026 19:30
@blt
blt changed the base branch from blt/chore_antithesis_tidy_up_sut_assertions to graphite-base/2111 July 14, 2026 19:47
@graphite-app
graphite-app Bot changed the base branch from graphite-base/2111 to main July 14, 2026 19:47
@blt
blt force-pushed the blt/fix_core_agent_health_check_retry branch 2 times, most recently from 31ccfef to b3c4cec Compare July 14, 2026 19:47
At boot time ADP establishes a gRPC connection with core Agent. This
connection is done in multiple parts, remote agent registration,
hostname fetch, health check etc. Most of these are managed by
RemoteAgentClient and are retried, however, the health check is attempted
only once post-connection. This means that a network partition between
a successful connection and the health check terminates ADP.

This commit moves the health check into the same retry scheme as the
rest of the boot sequence.

REF SMPTNG-766
@blt
blt force-pushed the blt/fix_core_agent_health_check_retry branch from b3c4cec to b4fe46c Compare July 14, 2026 19:48

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

PR moves health check into the retry loop, allowing transient RPC failures during boot to be retried instead of failing immediately. The change is architecturally sound: the health check validates connection and authentication once per retry attempt, and the returned service is unused and in good state for client creation. All error paths are properly handled, and the API remains unchanged for callers.

Was this helpful? React 👍 or 👎

📊 Validated against 5 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit b3c4cec · What is Autotest? · Any feedback? Reach out in #autotest

@blt
blt merged commit 06d847c into main Jul 14, 2026
80 of 88 checks passed

blt commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jul 14, 8:05 PM UTC: @blt merged this pull request with Graphite.

@blt
blt deleted the blt/fix_core_agent_health_check_retry branch July 14, 2026 20:05
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 14, 2026
… boot (#2111)

## Summary
<!-- Please provide a brief summary about what this PR does.
This should help the reviewers give feedback faster and with higher quality. -->

At boot time ADP establishes a gRPC connection with core Agent. This
connection is done in multiple parts, remote agent registration,
hostname fetch, health check etc. Most of these are managed by
RemoteAgentClient and are retried, however, the health check is attempted
only once post-connection. This means that a network partition between
a successful connection and the health check terminates ADP.

This commit moves the health check into the same retry scheme as the
rest of the boot sequence.

## Change Type
- [x] Bug fix
- [ ] New feature
- [ ] Non-functional (chore, refactoring, docs)
- [ ] Performance

## How did you test this PR?
<!-- Please how you tested these changes here -->

## References

<!-- Please list any issues closed by this PR. -->

REF SMPTNG-766

<!--
- Closes: <issue link>
-->

<!-- Any other issues or PRs relevant to this PR? Feel free to list them here. --> 06d847c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants