Skip to content

feat(ping): propagate trace context in cron monitor pings#600

Merged
notheotherben merged 1 commit into
mainfrom
claude/determined-hamilton-92drpa
Jun 19, 2026
Merged

feat(ping): propagate trace context in cron monitor pings#600
notheotherben merged 1 commit into
mainfrom
claude/determined-hamilton-92drpa

Conversation

@notheotherben

Copy link
Copy Markdown
Member

Summary

Adds W3C trace headers (e.g. traceparent) to the HTTP requests sent to the configured cron monitor URLs (start / success / failure). This lets the monitoring service's telemetry be correlated with the originating backup run, enabling cross-service tracing when things fail — exactly the goal described in the request.

What changed

  • src/telemetry/trace_propagation.rs (new): a small, reusable helper built on the OpenTelemetry text map propagator that the OpenTelemetry battery already installs globally.
    • A private HeaderInjector that writes propagated fields into a reqwest::header::HeaderMap, skipping anything that isn't a valid HTTP header.
    • A TracePropagationExt extension trait adding .with_trace_context() to reqwest::RequestBuilder, which injects the current span's trace context into the outgoing request.
  • src/ping.rs: the cron-monitor GET requests now call .with_trace_context().
  • src/telemetry/mod.rs: re-exports the new module.

When telemetry export is disabled (no valid span context), no headers are added, so requests are left untouched.

Notes

  • The injector is intentionally generic on reqwest::RequestBuilder so other outbound HTTP clients (GitHub/Forgejo) can adopt the same propagation later if desired.

Testing

  • cargo build
  • cargo test --features pure_tests ✅ (109 passed; network-gated tests ignored as usual)
  • New unit tests verify a valid context produces the correct traceparent header and that an empty context produces none.
  • cargo fmt --check and cargo clippy --all-targets

🤖 Generated with Claude Code


Generated by Claude Code

Inject the current span's W3C trace context (e.g. the `traceparent`
header) into the HTTP GET requests sent to the configured cron monitor
URLs. This lets the monitoring service's telemetry be correlated with the
originating backup run when investigating cross-service failures.

A reusable `TracePropagationExt` extension trait is added to the
telemetry module so any `reqwest::RequestBuilder` can opt in via
`.with_trace_context()`, using the globally configured OpenTelemetry text
map propagator installed by the OpenTelemetry battery.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvLUhVVh5My5zTN4aCoJjY
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.18%. Comparing base (48371c9) to head (ce52c3f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #600      +/-   ##
==========================================
+ Coverage   72.74%   73.18%   +0.43%     
==========================================
  Files          29       30       +1     
  Lines        2077     2111      +34     
==========================================
+ Hits         1511     1545      +34     
  Misses        566      566              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@notheotherben notheotherben merged commit a9adf00 into main Jun 19, 2026
13 checks passed
@notheotherben notheotherben deleted the claude/determined-hamilton-92drpa branch June 19, 2026 08:10
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