Skip to content

feat(rust): axum weblog#7288

Draft
MilanGarnier wants to merge 19 commits into
mainfrom
milan.garnier/axum-weblog
Draft

feat(rust): axum weblog#7288
MilanGarnier wants to merge 19 commits into
mainfrom
milan.garnier/axum-weblog

Conversation

@MilanGarnier

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

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

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 3 Pipeline jobs failed

Testing the test | Test the test   View in Datadog   GitHub Actions

DataDog/system-tests | java7-app.arm64.DOA9: [public.ecr.aws/lts/ubuntu:22.04, linux/arm64, ]   View in Datadog   GitLab

Testing the test | all-jobs-are-green   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 69344c6 | 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.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
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".

# docs/understand/weblogs/weblog-metadata.md

axum:
categories: [dd_trace]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove the unsupported weblog metadata key

When the rust end-to-end workflow loads weblogs, WeblogMetaData._load_explicit_metadata() passes each YAML value directly into WeblogMetaData(name=..., library=..., **kwargs), but that dataclass only accepts build_mode, framework_versions, and artifact_name. This new categories key therefore raises TypeError: unexpected keyword argument 'categories' before the axum weblog can be returned, blocking rust CI/workflow parameter computation; omit this file or use only supported metadata fields.

Useful? React with 👍 / 👎.

.route("/sample_rate_route/{i}", get(sample_rate_route))
.route("/flush", get(flush))
.route("/createextraservice", get(create_extra_service))
.route("/e2e_otel_span", get(e2e_otel_span))

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 Skip or implement the mixed-contrib OTel endpoint

In APM_TRACING_E2E_OTEL, Test_Otel_Span::setup_distributed_otel_trace requests /e2e_otel_span/mixed_contrib; other non-Go manifests mark that test irrelevant because it is Go-contrib-specific. The Rust manifest does not skip it, and this router only registers the exact /e2e_otel_span path, so the new Axum weblog will return 404 and the scenario will fail as soon as it runs that test. Add the route or mark test_distributed_otel_trace unsupported for Rust.

Useful? React with 👍 / 👎.

Comment on lines +136 to +137
cargo remove datadog-opentelemetry >/dev/null 2>&1 || true
if ! cargo add datadog-opentelemetry --features metrics-http,metrics-grpc,logs-http,logs-grpc >/dev/null 2>&1; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve Axum's pinned tracer dependency

For the normal Axum build with no /binaries/dd-trace-rs, this branch removes the datadog-opentelemetry git revision that utils/build/docker/rust/axum/Cargo.toml says is required to keep all OTel crates on 0.32, then resolves crates.io instead. With the published 0.4.0 still on OTel 0.31, align_opentelemetry pulls direct deps back to 0.31 while opentelemetry-instrumentation-tower/tracing-opentelemetry remain 0.32, so the new check_single_opentelemetry_version rejects the graph or server spans become no-ops. Keep the existing git dependency for Axum unless a local checkout is supplied.

Useful? React with 👍 / 👎.

Comment on lines +279 to +281
let mut parent = tracer
.span_builder(parent_name.to_owned())
.with_kind(SpanKind::Internal)

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 Set the expected OTel parent span ID

When APM_TRACING_E2E_OTEL runs Test_Otel_Span::test_datadog_otel_span for Rust, it asserts the root span named by parentName has span ID 10000 for every language except JVM/PHP; the Go weblog explicitly starts that span with WithSpanID(10000). This implementation starts a normal OTel span here, so Rust will emit a random span ID and fail the enabled test unless the ID is forced or the test is marked unsupported for Rust.

Useful? React with 👍 / 👎.

Comment thread utils/build/docker/rust/axum/src/url.rs Outdated
Comment on lines +31 to +35
if is_sensitive_key(key) {
// Replace the entire key=value pair with <redacted>
parts.push("<redacted>".to_owned());
} else {
parts.push(pair.to_owned());

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 Redact sensitive values inside JSON query strings

In the default scenario, tests/test_scrubbing.py::Test_UrlQuery is not disabled for Rust and sends ?json={"sign":"leak-url-main-v4"} before asserting no leak-url-main appears in tracer payloads. This scrubber only checks the query parameter name (json), so that value is copied into the http.url attribute unchanged; either implement the same JSON/sign obfuscation the test expects or mark the scrubbing tests missing for Rust.

Useful? React with 👍 / 👎.

COPY --from=builder /usr/app/weblog /app/weblog
COPY --from=builder /usr/app/SYSTEM_TESTS_LIBRARY_VERSION /app/SYSTEM_TESTS_LIBRARY_VERSION
COPY utils/build/docker/rust/axum/app.sh /app/app.sh
RUN chmod +x /app/app.sh

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 Keep tracer log level out of the Docker image

Setting DD_LOG_LEVEL=debug in the Axum Dockerfile enables debug tracer logging for every Rust end-to-end scenario, not just a targeted debugging run, which can inflate CI logs and change telemetry/config assertions. The repo's PR review guidance says tracer/agent behavior env vars belong in scenario weblog_env/agent_env, so remove this or set it only on scenarios that need debug logging.

Useful? React with 👍 / 👎.

.route("/flush", get(flush))
.route("/createextraservice", get(create_extra_service))
.route("/e2e_otel_span", get(e2e_otel_span))
.route("/e2e_single_span", get(e2e_single_span))

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 Disable single-span E2E until Rust supports SSS

Registering /e2e_single_span makes the new Axum weblog participate in APM_TRACING_E2E_SINGLE_SPAN, but the Rust manifest still marks the equivalent root/child single-span sampling parametric cases as missing_feature. The end-to-end test asserts those spans carry single-span sampling metrics and that only the selected span reaches the backend, so this scenario will fail for Rust unless SSS support is actually added or tests/apm_tracing_e2e/test_single_span.py::Test_SingleSpan is marked unsupported.

Useful? React with 👍 / 👎.

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.
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.

1 participant