Skip to content

feat(libdd-healthplatform): add no_std crate for agent-payload healthplatform.proto#1987

Draft
pawelchcki wants to merge 2 commits into
mainfrom
no-std-agent-health-client
Draft

feat(libdd-healthplatform): add no_std crate for agent-payload healthplatform.proto#1987
pawelchcki wants to merge 2 commits into
mainfrom
no-std-agent-health-client

Conversation

@pawelchcki
Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a new workspace crate libdd-healthplatform that vendors agent-payload's healthplatform.proto and exposes prost-generated Rust types for all 10 messages as a no_std + alloc library.

  • Encoding is always available.
  • Decoding helpers live behind the decode feature (API-surface gate; prost-build emits the decoders regardless).
  • Regeneration of src/healthplatform.rs is behind the generate-protobuf feature so CI uses the checked-in output.
  • A feature-gated example (example-client) ships a tiny client that POSTs a JSON HealthReport through the local trace-agent's evp_proxy to agenthealth-intake.<site>/api/v2/agenthealth, matching datadog-agent/comp/healthplatform/impl/forwarder.go's wire format (Content-Type: application/json, snake_case keys).

Motivation

libdatadog had no Rust types for the agent-health intake schema. This crate is the substrate other libdatadog components (and downstream tracers) need to report agent-health issues without pulling in std.

Additional Notes

  • map<> fields are emitted as BTreeMap to keep the generated code no_std-clean.
  • google.protobuf.Struct is reused from prost-types rather than vendored.
  • Example uses JSON because the agthealth-worker drops anything that isn't INTERNAL_INTAKE_REQUEST or JSON (verified end-to-end against staging — HTTP 202, drop counter flat).

How to test the change?

# default build (no_std lib)
cargo build -p libdd-healthplatform
cargo build -p libdd-healthplatform --no-default-features
cargo build -p libdd-healthplatform --features decode

# regen is stable (zero diff)
cargo build -p libdd-healthplatform --features generate-protobuf

# round-trip tests pass with and without `decode`
cargo test -p libdd-healthplatform
cargo test -p libdd-healthplatform --features decode

# example builds and (against a local trace-agent on :8136) returns 202
cargo build -p libdd-healthplatform --example evp_proxy_send --features example-client,decode
cargo run   -p libdd-healthplatform --example evp_proxy_send --features example-client,decode

# lints + fmt
cargo clippy -p libdd-healthplatform --all-features --all-targets -- -D warnings
cargo +nightly fmt -p libdd-healthplatform -- --check

Vendors `agent-payload/proto/healthplatform/healthplatform.proto` and ships
prost-generated Rust types as `no_std + alloc`. Encoding is always on; the
`decode` feature gates a public decode helper module. A feature-gated example
(`evp_proxy_send`) demonstrates POSTing a JSON `HealthReport` through the
trace-agent's evp_proxy to `agenthealth-intake.<site>/api/v2/agenthealth`,
mirroring the wire format used by `comp/healthplatform/impl/forwarder.go`.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

📚 Documentation Check Results

⚠️ 5 documentation warning(s) found

📦 libdd-healthplatform - 5 warning(s)


Updated: 2026-05-14 13:48:46 UTC | Commit: 62f827c | missing-docs job results

@github-actions
Copy link
Copy Markdown
Contributor

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

  • Base Branch: origin/main
  • PR Branch: origin/no-std-agent-health-client

Summary by Rule

Rule Base Branch PR Branch Change

Annotation Counts by File

File Base Branch PR Branch Change

Annotation Stats by Crate

Crate Base Branch PR Branch Change
clippy-annotation-reporter 5 5 No change (0%)
datadog-ffe-ffi 1 1 No change (0%)
datadog-ipc 21 21 No change (0%)
datadog-live-debugger 6 6 No change (0%)
datadog-live-debugger-ffi 10 10 No change (0%)
datadog-profiling-replayer 4 4 No change (0%)
datadog-remote-config 3 3 No change (0%)
datadog-sidecar 57 57 No change (0%)
libdd-common 13 13 No change (0%)
libdd-common-ffi 12 12 No change (0%)
libdd-data-pipeline 5 5 No change (0%)
libdd-ddsketch 2 2 No change (0%)
libdd-dogstatsd-client 1 1 No change (0%)
libdd-profiling 13 13 No change (0%)
libdd-telemetry 20 20 No change (0%)
libdd-tinybytes 4 4 No change (0%)
libdd-trace-normalization 2 2 No change (0%)
libdd-trace-obfuscation 8 8 No change (0%)
libdd-trace-stats 1 1 No change (0%)
libdd-trace-utils 15 15 No change (0%)
Total 203 203 No change (0%)

About This Report

This report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

🔒 Cargo Deny Results

No issues found!

📦 libdd-healthplatform - ✅ No issues


Updated: 2026-05-14 13:48:56 UTC | Commit: 62f827c | dependency-check job results

…ON helpers

- Remove `encode`/`decode` modules and the `decode` feature; consumers call
  `report.encode_to_vec()` / `HealthReport::decode(bytes)` directly via the
  prost `Message` trait that every generated type already implements.
- Stop re-exporting `prost` / `prost_types` from the crate root; the
  integration test imports them as direct dev-dependencies. Closes off an
  accidental public ABI surface.
- Drop `rustls` from reqwest's feature set in the example; we POST to
  localhost over plain HTTP.
- Collapse the ~140-line `health_report_to_json` / `issue_to_json` boilerplate
  to three small `put_str` / `put_opt_str` / `put_str_vec` helpers; matches
  Go `encoding/json` + omitempty semantics with much less noise.
- Dedupe leap-year arithmetic in the example's `now_rfc3339`.
@datadog-official
Copy link
Copy Markdown

datadog-official Bot commented May 14, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 0.00%
Overall Coverage: 72.68% (+0.05%)

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

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.68%. Comparing base (0a3304c) to head (2260f25).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1987      +/-   ##
==========================================
+ Coverage   72.63%   72.68%   +0.04%     
==========================================
  Files         451      452       +1     
  Lines       74687    74702      +15     
==========================================
+ Hits        54249    54297      +48     
+ Misses      20438    20405      -33     
Components Coverage Δ
libdd-crashtracker 65.32% <ø> (+0.02%) ⬆️
libdd-crashtracker-ffi 37.68% <ø> (ø)
libdd-alloc 98.77% <ø> (ø)
libdd-data-pipeline 86.30% <ø> (+0.33%) ⬆️
libdd-data-pipeline-ffi 72.97% <ø> (+1.92%) ⬆️
libdd-common 79.81% <ø> (ø)
libdd-common-ffi 74.41% <ø> (ø)
libdd-telemetry 73.34% <ø> (ø)
libdd-telemetry-ffi 31.36% <ø> (ø)
libdd-dogstatsd-client 82.64% <ø> (ø)
datadog-ipc 76.22% <ø> (+0.04%) ⬆️
libdd-profiling 81.58% <ø> (-0.02%) ⬇️
libdd-profiling-ffi 64.51% <ø> (ø)
libdd-sampling 97.25% <ø> (ø)
datadog-sidecar 29.26% <ø> (+0.16%) ⬆️
datdog-sidecar-ffi 10.48% <ø> (+0.81%) ⬆️
spawn-worker 48.86% <ø> (ø)
libdd-tinybytes 93.16% <ø> (ø)
libdd-trace-normalization 81.71% <ø> (ø)
libdd-trace-obfuscation 87.39% <ø> (ø)
libdd-trace-protobuf 68.25% <ø> (ø)
libdd-trace-utils 89.59% <ø> (ø)
libdd-tracer-flare 86.88% <ø> (ø)
libdd-log 74.83% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 14, 2026

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.57 MB 7.57 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 81.84 MB 81.84 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 98.03 MB 98.03 MB 0% (0 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.01 MB 10.01 MB 0% (0 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 24.48 MB 24.48 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 79.87 KB 79.87 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 180.22 MB 180.23 MB +0% (+8.00 KB) 👌
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 913.96 MB 913.96 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 7.73 MB 7.73 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 79.87 KB 79.87 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 23.17 MB 23.17 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 45.36 MB 45.36 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 21.09 MB 21.09 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 81.11 KB 81.11 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 184.41 MB 184.41 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 900.44 MB 900.44 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 5.99 MB 5.99 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 81.11 KB 81.11 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 24.81 MB 24.81 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 42.87 MB 42.87 MB 0% (0 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 72.93 MB 72.93 MB 0% (0 B) 👌
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.42 MB 8.42 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 90.70 MB 90.70 MB 0% (0 B) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.06 MB 10.06 MB 0% (0 B) 👌

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.

2 participants