feat(rust): axum weblog - #7288
Merged
Merged
Conversation
fix: error at building weblog)
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 2d0ae98 | Docs | Datadog PR Page | Give us feedback! |
Contributor
|
|
Contributor
Author
|
@codex review |
There was a problem hiding this comment.
💡 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".
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
utils/build/docker/rust/axum/): an Axum HTTP server instrumented withdd-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).utils/build/docker/rust/axum.Dockerfile): a multi-stage build that compiles the weblog and installsdd-trace-rsviainstall_ddtrace.sh, and adds the corresponding mirror image entry.manifests/rust.yml): mark tests that exercise endpoints or features not yet implemented in the Axum weblog or indd-trace-rsasmissing_feature/incomplete_test_app/irrelevant, while removing entries that no longer apply now that this weblog exists.client_iptagging, referer-hostname extraction,and query-string obfuscation unimplemented in the weblog rather than
faking them, since those are tracer responsibilities.
datadog-opentelemetry,tracing-opentelemetry,opentelemetry-instrumentation-towerand theopentelemetry*crates must all resolve to the sameopentelemetryminor 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.shcurrently enforces this at build time rather than via staticCargo.tomlpins: it installsdatadog-opentelemetry, inspectscargo metadatato find the OTel minor it resolved to, re-pins the other OTel/contrib crates to match, then fails the build ifcargo metadatastill shows more than oneopentelemetryversion (usually becauseopentelemetry-instrumentation-tower, which is git-pinned, has drifted).This self-adjusts as
dd-trace-rsmoves, 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
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present