feat(rust): axum weblog#7288
Conversation
fix: error at building weblog)
|
|
|
|
@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".
| # docs/understand/weblogs/weblog-metadata.md | ||
|
|
||
| axum: | ||
| categories: [dd_trace] |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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 👍 / 👎.
| 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 |
There was a problem hiding this comment.
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 👍 / 👎.
| let mut parent = tracer | ||
| .span_builder(parent_name.to_owned()) | ||
| .with_kind(SpanKind::Internal) |
There was a problem hiding this comment.
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 👍 / 👎.
| if is_sensitive_key(key) { | ||
| // Replace the entire key=value pair with <redacted> | ||
| parts.push("<redacted>".to_owned()); | ||
| } else { | ||
| parts.push(pair.to_owned()); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
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
🚀 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