Skip to content

Fix the HTTP request span reporting named schemas as _Default - #10454

Merged
glen-84 merged 1 commit into
mainfrom
gai/http-request-span-schema-name
Sep 30, 2026
Merged

glen-84 merged 1 commit into
mainfrom
gai/http-request-span-schema-name

Conversation

@glen-84

@glen-84 glen-84 commented Sep 30, 2026

Copy link
Copy Markdown
Member

Summary

  • The ExecuteHttpRequest span tagged graphql.schema.name as _Default for every schema, including one mapped with MapGraphQL(path, schemaName). The span read the name from HttpContext.Items, and nothing has written that key since Add Fusion Transport Layer #8410 removed the middleware writes, so this has been wrong since 16.0.0.
  • The Hot Chocolate and Fusion server listeners now take the schema name from their AddInstrumentation registration and pass it to the span. Only internal types change.

Test plan

  • New tests in ActivityServerDiagnosticListenerTests (a named Hot Chocolate schema) and FusionActivityServerDiagnosticListenerTests (a named Fusion gateway) check the tag on the ExecuteHttpRequest span, and both fail without the fix. They read the captured spans once in-flight spans have finished, which ActivityTestHelper.Capture.Settled now exposes, and the Fusion test names its gateway through a new optional gatewayName on FusionTestBase.CreateCompositeSchemaAsync.
  • HotChocolate.Diagnostics.Tests and HotChocolate.Fusion.Diagnostics.Tests pass on net8.0 to net11.0, with the existing snapshots of unnamed schemas still showing _Default.
  • HotChocolate.Fusion.AspNetCore.Tests passes on net10.0.

Copilot AI lite review requested due to automatic review settings September 30, 2026 12:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified, and the supplied assessments support approval.

Review effort: Lite
Findings: None

What changed in this PR

Fixes HTTP request telemetry to report registered schema names instead of _Default.

Changes:

  • Pass schema names from Hot Chocolate and Fusion instrumentation.
  • Remove obsolete HttpContext.Items lookup.
  • Add named-schema tests and settled activity capture support.
File Summary
src/​HotChocolate/​Fusion/​test/​Fusion.Diagnostics.Tests/​FusionActivityServerDiagnosticListenerTests.cs Tests named Fusion gateway schemas.
src/​HotChocolate/​Fusion/​test/​Fusion.Diagnostics.Tests/​ActivityTestHelper.cs Exposes settled captured activities.
src/​HotChocolate/​Fusion/​test/​Fusion.AspNetCore.Tests/​FusionTestBase.cs Supports named gateway test schemas.
src/​HotChocolate/​Fusion/​src/​Fusion.Diagnostics/​Listeners/​FusionActivityServerDiagnosticListener.cs Passes the Fusion schema name to spans.
src/​HotChocolate/​Fusion/​src/​Fusion.Diagnostics/​Extensions/​DiagnosticsFusionGatewayBuilderExtensions.cs Supplies the registered gateway name.
src/​HotChocolate/​Diagnostics/​test/​Diagnostics.Tests/​ActivityTestHelper.cs Exposes settled captured activities.
src/​HotChocolate/​Diagnostics/​test/​Diagnostics.Tests/​ActivityServerDiagnosticListenerTests.cs Tests named Hot Chocolate schemas.
src/​HotChocolate/​Diagnostics/​src/​Diagnostics/​Listeners/​ActivityServerDiagnosticListener.cs Passes the Hot Chocolate schema name to spans.
src/​HotChocolate/​Diagnostics/​src/​Diagnostics/​Extensions/​DiagnosticsRequestExecutorBuilderExtensions.cs Supplies the registered schema name.
src/​HotChocolate/​Diagnostics/​src/​Diagnostics.Core/​Spans/​Http/​ExecuteHttpRequestSpan.cs Uses the supplied schema name for telemetry.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (18/18)

File Covered Changed Patch %
…/Extensions/DiagnosticsRequestExecutorBuilderExtensions.cs 1 1 100.0% 🟢
…/Diagnostics/Listeners/ActivityServerDiagnosticListener.cs 8 8 100.0% 🟢
…/Extensions/DiagnosticsFusionGatewayBuilderExtensions.cs 1 1 100.0% 🟢
…/Listeners/FusionActivityServerDiagnosticListener.cs 8 8 100.0% 🟢

Project coverage: 57.8% (299315/518141 lines)

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.

2 participants