Skip to content

feat(rust): axum weblog - #7288

Merged
genesor merged 42 commits into
mainfrom
milan.garnier/axum-weblog
Jul 29, 2026
Merged

feat(rust): axum weblog#7288
genesor merged 42 commits into
mainfrom
milan.garnier/axum-weblog

Conversation

@MilanGarnier

@MilanGarnier MilanGarnier commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Motivation

Rust is lacking a weblog to run end to end tests. The goal is to provide a canonical weblog based on axum and community otel integrations.

Changes

Introduces a new Axum-based Rust weblog and wires it into the end-to-end test suite:

  • New weblog app (utils/build/docker/rust/axum/): an Axum HTTP server instrumented with dd-trace-rs, exposing the core endpoints needed by end-to-end tests (/, /healthcheck, /headers, /status, /spans, /stats-unique, /params/{value}, /sample_rate_route/{i}, /flush, /createextraservice, /e2e_otel_span, /e2e_single_span, /returnheaders, /make_distant_call, and the OTel drop-in propagator endpoints).
  • Docker build (utils/build/docker/rust/axum.Dockerfile): a multi-stage build that compiles the weblog and installs dd-trace-rs via install_ddtrace.sh, and adds the corresponding mirror image entry.
  • Manifest updates (manifests/rust.yml): mark tests that exercise endpoints or features not yet implemented in the Axum weblog or in dd-trace-rs as missing_feature/incomplete_test_app/irrelevant, while removing entries that no longer apply now that this weblog exists.
  • Deliberately keeps client_ip tagging, referer-hostname extraction,
    and query-string obfuscation unimplemented in the weblog rather than
    faking them, since those are tracer responsibilities.

⚠️ OpenTelemetry dependency resolution (open for discussion)

datadog-opentelemetry, tracing-opentelemetry,opentelemetry-instrumentation-tower and the opentelemetry* crates must all resolve to the same opentelemetry minor version, or Rust links two copies side by side and half the app silently gets a no-op tracer/propagator (no server spans, no context extraction).

install_ddtrace.sh currently enforces this at build time rather than via static Cargo.toml pins: it installs datadog-opentelemetry, inspects cargo metadata to find the OTel minor it resolved to, re-pins the other OTel/contrib crates to match, then fails the build if cargo metadata still shows more than one opentelemetry version (usually because opentelemetry-instrumentation-tower, which is git-pinned, has drifted).

This self-adjusts as dd-trace-rs moves, but it's a lot of logic standing in for what should be static dependency info, and it only fails at build time, not at edit time. Not settled — open to alternatives (vendoring/forking the tower crate, manual re-pinning).

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@datadog-official

datadog-official Bot commented Jul 10, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

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

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

utils/build/docker/rust/axum.Dockerfile                                 @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/.gitignore                                 @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/Cargo.lock                                 @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/Cargo.toml                                 @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/app.sh                                     @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/src/integration/axum_layer.rs              @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/src/integration/mod.rs                     @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/src/integration/reqwest_backend.rs         @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/src/main.rs                                @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/axum/system_tests_library_version.sh            @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/weblog_metadata.yml                             @DataDog/apm-rust @DataDog/system-tests-core
docs/execute/build.md                                                   @DataDog/system-tests-core
docs/understand/weblogs/end-to-end_weblog.md                            @DataDog/system-tests-core
manifests/rust.yml                                                      @DataDog/apm-rust
mirror_images.lock.yaml                                                 @DataDog/system-tests-core
mirror_images.yaml                                                      @DataDog/system-tests-core
tests/schemas/utils/library/v0.7/config-request.json                    @DataDog/system-tests-core
tests/test_telemetry.py                                                 @DataDog/libdatadog-telemetry @DataDog/apm-sdk-capabilities @DataDog/system-tests-core
utils/build/docker/rust/install_ddtrace.sh                              @DataDog/apm-rust @DataDog/system-tests-core
utils/build/docker/rust/parametric/Cargo.lock                           @DataDog/apm-rust @DataDog/system-tests-core

@MilanGarnier MilanGarnier changed the title Milan.garnier/axum weblog feat(rust): axum weblog Jul 10, 2026
@MilanGarnier

Copy link
Copy Markdown
Contributor Author

@codex review

@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: dc1864abb4

ℹ️ 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 thread utils/build/docker/rust/weblog_metadata.yml
Comment thread utils/build/docker/rust/axum/src/main.rs
Comment thread utils/build/docker/rust/install_ddtrace.sh
Comment thread utils/build/docker/rust/axum/src/main.rs
Comment thread utils/build/docker/rust/axum/src/url.rs Outdated
Comment thread utils/build/docker/rust/axum.Dockerfile
Comment thread utils/build/docker/rust/axum/src/main.rs
MilanGarnier and others added 8 commits July 15, 2026 15:18
Client-IP resolution (forwarded-header priority + public-IP filtering)
and referer-hostname extraction are tracer/appsec responsibilities. The
weblog hand-rolled them, so Test_StandardTagsClientIp and
Test_StandardTagsReferrerHostname were validating the fixture rather
than dd-trace-rs. Remove the logic and mark those tests missing_feature.
Query-string obfuscation of http.url is a tracer responsibility. The
weblog's hand-rolled scrubber only served fixture-tested scrubbing cases
(all already missing_feature for Rust), so drop it entirely and report
the URL verbatim — the weblog now does near-zero tracer-side work. The
outgoing-call span still rebuilds its URL from host_str(), so userinfo
is dropped and Test_UrlField is unaffected.
@MilanGarnier
MilanGarnier requested a review from Copilot July 16, 2026 13:47
Crate is on crates.io but no release ships the HTTPLayer we need yet.
Note the intended migration path back to install_ddtrace.sh's
align_opentelemetry() once that release lands.
…_opentelemetry

Previously align_opentelemetry left this crate untouched and just failed
the build if its rev drifted from datadog-opentelemetry's OTel minor.
Now it re-pins the crate to the known-good rev itself; a TODO flags that
picking a compatible rev for OTel minors past 0.32 needs a real strategy.
…ep (#7399)

Stacked on top of #7288 (base: milan.garnier/axum-weblog). Review/merge that first.

What
The axum weblog used the git-only opentelemetry-instrumentation-tower crate (HTTPLayer) purely to create the inbound server span and extract upstream trace context, with a second from_fn layer adding the Datadog attributes. This replaces both with a single from_fn middleware (integration/axum_layer.rs) and drops the crate entirely.

Why
Because the crate is git-only, its OpenTelemetry minor was fixed by a hardcoded rev (66bfea4, OTel 0.32). align_opentelemetry therefore needed a special-cased re-pin plus a fail/TODO for any newer minor — the one non-derivable pin in the whole alignment, and the thing that would break system-tests the moment datadog-opentelemetry moved to a new OTel minor.

Every remaining OTel peer crate (opentelemetry*, reqwest-tracing, tracing-opentelemetry) is on crates.io, so after this change align_opentelemetry pins no git rev and there is nothing to bump by hand on a minor change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants