Repository navigation
Fix the HTTP request span reporting named schemas as _Default - #10454
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.Itemslookup. - 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.
Contributor
Patch coverage100.0% of changed lines covered (18/18)
Project coverage: 57.8% (299315/518141 lines) |
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.
Summary
ExecuteHttpRequestspan taggedgraphql.schema.nameas_Defaultfor every schema, including one mapped withMapGraphQL(path, schemaName). The span read the name fromHttpContext.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.AddInstrumentationregistration and pass it to the span. Only internal types change.Test plan
ActivityServerDiagnosticListenerTests(a named Hot Chocolate schema) andFusionActivityServerDiagnosticListenerTests(a named Fusion gateway) check the tag on theExecuteHttpRequestspan, and both fail without the fix. They read the captured spans once in-flight spans have finished, whichActivityTestHelper.Capture.Settlednow exposes, and the Fusion test names its gateway through a new optionalgatewayNameonFusionTestBase.CreateCompositeSchemaAsync.HotChocolate.Diagnostics.TestsandHotChocolate.Fusion.Diagnostics.Testspass onnet8.0tonet11.0, with the existing snapshots of unnamed schemas still showing_Default.HotChocolate.Fusion.AspNetCore.Testspasses onnet10.0.