[Diagnostics] Include HTTP and MCP spans in diagnostic test snapshots#9682
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the diagnostics snapshot tests to also capture and assert on transport-level spans (ASP.NET Core inbound HTTP and outgoing HttpClient spans), including MCP activities, so snapshots reflect the full trace hierarchy instead of only HotChocolate/Fusion spans.
Changes:
- Add OpenTelemetry ASP.NET Core + HttpClient instrumentation dependencies to the diagnostics test projects.
- Enable ASP.NET Core + HttpClient instrumentation (and MCP activity source) in the
ActivityTestHelpertracer providers for diagnostics tests. - Update Fusion test harness to emit/propagate outgoing HTTP spans when routing gateway→subgraph calls through
TestServer, and refresh snapshots accordingly.
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Directory.Packages.props | Adds centrally-managed versions for OTel ASP.NET Core/Http instrumentation packages. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/HotChocolate.Fusion.Diagnostics.Tests.csproj | Adds OTel ASP.NET Core + Http instrumentation package references for Fusion diagnostics tests. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/ActivityTestHelper.cs | Enables ASP.NET Core + HttpClient instrumentation and MCP activity source; makes snapshot “source name” deterministic. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.RequestDetails_DocumentOnly_IncludesDocumentTag.snap | Snapshot updated to include HTTP server/client spans and adjusted span nesting. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.RequestDetails_Default_IncludesIdHashOperationNameExtensions.snap | Snapshot updated to include HTTP server/client spans and adjusted span nesting. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_With_Extensions_Map.snap | Snapshot updated to include HTTP server/client spans and adjusted span nesting. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_Variables_Are_Not_Automatically_Added_To_Activities.snap | Snapshot updated to include HTTP server/client spans and adjusted span nesting. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_Single_Request.snap | Snapshot updated to include HTTP server/client spans and adjusted span nesting. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_Single_Request_Default.snap | Snapshot updated to include HTTP server/client spans and adjusted span nesting. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_Parser_Error.snap | Snapshot updated to include HTTP server/client spans and adjusted span nesting for error case. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Get_Single_Request.snap | Snapshot updated to include HTTP server spans for GET requests. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Get_SDL_Download.snap | Snapshot updated to include HTTP server spans for SDL download. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.VariableCoercion_FailingScalar_RecordsErrorOnCoercionSpan.snap | Snapshot updated to include outgoing HTTP client spans in execution traces. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.Track_Events_Of_A_Simple_Query_Default.snap | Snapshot updated to include outgoing HTTP client spans in execution traces. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.Track_Events_Of_A_Query_With_Multiple_Sources.snap | Snapshot updated to include outgoing HTTP client spans for multiple sources. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.SubscriptionEvent_Records_Subscription_Event_Span.snap | Snapshot updated to include outgoing HTTP client spans in subscription event traces. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.PersistedOperation_LoadsFromStorage_DefaultScopes.snap | Snapshot updated to include outgoing HTTP client spans in persisted operation scenario. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.MultipleSources_SourceSchemaResolverError_RecordsDeeplyNestedError.snap | Snapshot updated to include outgoing HTTP client spans in error scenario. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.DocumentCache_SecondExecution_RecordsCacheHitEvent.snap | Snapshot updated to include outgoing HTTP client spans in cache-hit scenario. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.DefaultScopes_ExcludesExecuteRequestAndParseDocumentSpans.snap | Snapshot updated to include transport spans under default scopes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.CustomScopes_OnlyValidateAndPlan_LimitsSpans.snap | Snapshot updated to include transport spans with custom scopes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.Cause_A_Resolver_Error_That_Deletes_The_Whole_Result.snap | Snapshot updated to include transport spans in resolver-error case. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.AllScopes_IncludesAllSpans.snap | Snapshot updated to include transport spans when all scopes enabled. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.Allow_Document_To_Be_Captured.snap | Snapshot updated to include transport spans when document capture is enabled. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.cs | Adds a delegating handler to emit HttpClient spans and propagate W3C context when using TestServer handlers. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/HotChocolate.Diagnostics.Tests.csproj | Adds OTel ASP.NET Core + Http instrumentation package references for diagnostics tests. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityTestHelper.cs | Enables ASP.NET Core + HttpClient instrumentation and MCP activity source; makes snapshot “source name” deterministic. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_None_ExcludesAllDetails.snap | Snapshot updated to include HTTP server spans and adjusted nesting. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_DocumentOnly_IncludesDocumentTag.snap | Snapshot updated to include HTTP spans and adjusted nesting. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_Default_IncludesIdHashOperationNameExtensions.snap | Snapshot updated to include HTTP spans and adjusted nesting. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_All_IncludesAllDetails.snap | Snapshot updated to include HTTP spans and adjusted nesting. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_With_Extensions_Map.snap | Snapshot updated to include HTTP spans and adjusted nesting. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Variables_Are_Not_Automatically_Added_To_Activities.snap | Snapshot updated to include HTTP spans and adjusted nesting. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_SingleRequest_GetHeroName.snap | Snapshot updated to include HTTP spans and adjusted nesting. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_SingleRequest_GetHeroName_Default.snap | Snapshot updated to include HTTP spans and adjusted nesting. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Parser_Error.snap | Snapshot updated to include HTTP spans and adjusted nesting for error case. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Capture_Deferred_Response.snap | Snapshot updated to include HTTP spans and adjusted nesting for deferred response. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Add_Variables_To_Http_Activity.snap | Snapshot updated to include HTTP spans and adjusted nesting when variables are captured. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Get_SingleRequest_GetHeroName.snap | Snapshot updated to include HTTP spans and adjusted nesting for GET request. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Get_SDL_Download.snap | Snapshot updated to include HTTP server spans for SDL download. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 13, 2026
Open
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.
No description provided.