← Back to Pull requests

feat(nitro): add Nitro v3 / h3 v2 tracing via TracingChannel #8716

Closed
unknown closed this pull request without merging on Aug 26, 2026 23:06 UTC
View on GitHub
unknown unknown commented on May 29, 2026 19:36 UTC
Author

What does this PR do?

Adds Nitro v3 / h3 v2 tracing via h3's native TracingChannel("h3.request").

  • Creates nitro.server.request spans with method, URL, route pattern, status code, errors, and distributed trace parenting.

  • Supports h3 v2 ESM by subscribing to tracing-channel events instead of shimmer wrapping h3 internals.

  • Covers both H3 and Nitro's production H3Core runtime path.

  • Reuses the standard web-server helpers for URL/query obfuscation, configured request/response header tags, filter, route/resource naming, status/error handling, and request hooks.

  • Avoids duplicate spans when h3 native tracing is enabled manually.
  • Motivation

    Nitro v3 and h3 v2 power Nuxt and other meta-framework server runtimes. h3 v2 is ESM-only, so native tracing-channel support is the stable instrumentation path.

    Verification

    Local checks:

  • ./node_modules/.bin/eslint --max-warnings 0 <changed nitro files> - passed.

  • env -u OTEL_TRACES_EXPORTER -u OTEL_LOGS_EXPORTER -u OTEL_METRICS_EXPORTER ./node_modules/.bin/mocha packages/datadog-plugin-nitro/test/index.spec.js - passed, 2 passing.

  • env -u OTEL_TRACES_EXPORTER -u OTEL_LOGS_EXPORTER -u OTEL_METRICS_EXPORTER /Users/william.conti/.nvm/versions/node/v22.17.0/bin/node ./node_modules/mocha/bin/mocha.js --timeout 60000 packages/datadog-plugin-nitro/test/integration-test/client.spec.js - passed, 12 passing.

  • env -u OTEL_TRACES_EXPORTER -u OTEL_LOGS_EXPORTER -u OTEL_METRICS_EXPORTER PLUGINS=nitro PATH=/Users/william.conti/.nvm/versions/node/v22.17.0/bin:$PATH /Users/william.conti/.nvm/versions/node/v22.17.0/bin/npm run test:plugins:ci - passed, 14 passing.

  • git diff --check -- <changed nitro files> - passed.
  • Live Datadog verification:

  • Ran a local Nitro/h3 sample app through a real Datadog Agent 7.78.0 using service nitro-h3-live-pr8716, env org2-live-verify, version f69fdacef-20260714-184518.

  • Exercised normal route, parameterized route, JSON body with status, returned Response with 503 under custom validateStatus, query obfuscation, configured request/response headers, thrown error, unmatched h3 route, Nitro H3Core runtime path, and plugin filter drop behavior.

  • Confirmed with Datadog MCP:

  • - Parameterized route trace (resource: GET /users/:id, http.route: /users/:id): https://app.datadoghq.com/apm/trace/6a56bbfe0000000043e26452e03a4e5e?graphType=flamegraph&shouldShowLegend=true&spanID=4891582452389793374&timeHint=1784069118650.0015&trace=6a56bbfe0000000043e26452e03a4e5e4891582452389793374&traceQuery=
    - Header/query trace (resource: GET /headers, http.route: /headers, configured request/response headers, query obfuscation): https://app.datadoghq.com/apm/trace/6a56bbfe000000007c9eef4da2735392?graphType=flamegraph&shouldShowLegend=true&spanID=8979877823740334994&timeHint=1784069118657.0696&trace=6a56bbfe000000007c9eef4da27353928979877823740334994&traceQuery=
    - Nitro H3Core runtime route-miss trace (resource: GET, no http.route, 404): https://app.datadoghq.com/apm/trace/6a56bbfe0000000005140e27304d88f3?graphType=flamegraph&shouldShowLegend=true&spanID=365933031200753907&timeHint=1784069118664.0007&trace=6a56bbfe0000000005140e27304d88f3365933031200753907&traceQuery=

    Diff: 404 lines (+303 / -101) across 5 files Reviewer: crysmags Review duration: 128369m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 404 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.359
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #8716"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.7% · Safe to merge
    17.7%