[Diagnostics] Add IncludeOperationNameInSpanName option#9874
Merged
tobias-tengler merged 4 commits intoJun 9, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new diagnostics/instrumentation option to control whether the GraphQL operation name is included in the root “GraphQL Operation” span name, and updates migration docs to help users recreate the previously removed RenameRootActivity behavior.
Changes:
- Add
IncludeOperationNameInSpanNametoInstrumentationOptionsBaseand apply it when setting the request spanActivity.DisplayName. - Add test coverage (Diagnostics + Fusion) for display name behavior when the option is enabled/disabled and when operations are named/anonymous.
- Update v16 migration docs (both
websiteandwebsite-next) with a sample for recreatingRenameRootActivityin user code.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md | Adds guidance + code sample to recreate RenameRootActivity behavior via a diagnostic listener + ASP.NET Core instrumentation enrichment. |
| website-next/content/docs/hotchocolate/migrating/migrate-from-15-to-16.md | Same migration guidance for the next website content pipeline (includes extra note about using EnrichWithHttpResponse). |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/FusionActivityExecutionDiagnosticListenerTests.cs | Adds Fusion tests asserting request span display name behavior for the new option. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/ActivityTestHelper.cs | Makes the capture type strongly typed and exposes exported activities for assertions. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityTestHelper.cs | Same test helper enhancement for Diagnostics tests. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityExecutionDiagnosticListenerTests.cs | Adds Diagnostics tests asserting request span display name behavior for the new option. |
| src/HotChocolate/Diagnostics/src/Diagnostics.Core/Spans/ExecuteRequestSpanBase.cs | Updates span naming logic to optionally include operation name in Activity.DisplayName. |
| src/HotChocolate/Diagnostics/src/Diagnostics.Core/InstrumentationOptionsBase.cs | Introduces IncludeOperationNameInSpanName option with XML docs describing cardinality implications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jun 16, 2026
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.