[Diagnostics] Align to OTEL spec Pt. 4#9658
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns Hot Chocolate diagnostics instrumentation (core + Fusion) with OpenTelemetry semantic conventions by enriching spans/events with additional standard attributes and tightening phase-specific span semantics, with corresponding snapshot updates in diagnostics tests.
Changes:
- Add
server.address/server.portenrichment on the root GraphQL request span when running under ASP.NET Core. - Propagate
graphql.document.hash/graphql.document.idintographql.errorevents and related diagnostic events; introducesubscription_eventprocessing type. - Add
InstrumentationOptions.EnableResolveFieldValueto allow disabling resolver instrumentation, and adjust variable-coercion span status behavior + tests/snapshots.
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/FusionActivityExecutionDiagnosticListenerTests.cs | Adds variable-coercion failure coverage and a custom scalar used to trigger coercion errors. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.RequestDetails_None_ExcludesAllDetails.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.RequestDetails_DocumentOnly_IncludesDocumentTag.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.RequestDetails_Default_IncludesIdHashOperationNameExtensions.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.RequestDetails_All_IncludesAllDetails.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_With_Extensions_Map.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_Variables_Are_Not_Automatically_Added_To_Activities.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_Single_Request.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_Single_Request_Default.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Post_Add_Variables_To_Http_Activity.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityServerDiagnosticListenerTests.Http_Get_Single_Request.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.VariableCoercion_FailingScalar_RecordsErrorOnCoercionSpan.snap | New snapshot for scalar coercion failure activity tree. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.ValidationError_UnknownField_ReportsErrorStatus.snap | Snapshot updated to include document hash on error event tags. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.SubscriptionEvent_Records_Subscription_Event_Span.snap | Updates processing type tag to subscription_event. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.Source_Schema_Transport_Error.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.ParsingError_InvalidGraphQLDocument_ReportsErrorStatus.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.MultipleSources_SourceSchemaResolverError_RecordsDeeplyNestedError.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.Ensure_That_The_Validation_Activity_Has_An_Error_Status.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.DocumentNotFoundInStorage_RecordsEvent.snap | Snapshot updated to include graphql.document.id tag on the event. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/snapshots/FusionActivityExecutionDiagnosticListenerTests.Cause_A_Resolver_Error_That_Deletes_The_Whole_Result.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Fusion/src/Fusion.Diagnostics/Listeners/FusionActivityExecutionDiagnosticEventListener.cs | Adds document-info propagation into error events and tags document-not-found events. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityExecutionDiagnosticListenerTests.cs | Adds scalar coercion failure coverage and supporting scalar/query types. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_None_ExcludesAllDetails.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_DocumentOnly_IncludesDocumentTag.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_Default_IncludesIdHashOperationNameExtensions.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_All_IncludesAllDetails.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_With_Extensions_Map.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Variables_Are_Not_Automatically_Added_To_Activities.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_SingleRequest_GetHeroName.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_SingleRequest_GetHeroName_Default.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Ensure_List_Path_Is_Correctly_Built.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Capture_Deferred_Response.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Add_Variables_To_Http_Activity.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Get_SingleRequest_GetHeroName.snap | Updates expected tags to include server attributes. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.VariableCoercion_FailingScalar_RecordsErrorOnCoercionSpan.snap | New snapshot verifying variable coercion span becomes error on coercion failure. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.ValidationError_UnknownField_ReportsErrorStatus.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.SubscriptionEventError_Records_Subscription_Event_Error.snap | Updates processing type + includes document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.SubscriptionEvent_Records_Subscription_Event_Span.snap | Updates processing type tag to subscription_event. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.ResolverException_OnNullableField_SetsErrorTypeToExceptionTypeName.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.ResolverError_DeepInTree_MarksNestedFieldAsError.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.ResolverError_AtRootLevel_MarksOperationAsError.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.ParsingError_InvalidGraphQLDocument_ReportsErrorStatus.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.MaxErrorEvents_CapsErrorEventsOnRootSpan.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.GraphQLError_WithoutExtensionsCode_FallsBackToExecutionError.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.GraphQLError_WithExtensionsCode_SetsErrorTypeFromCode.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.Ensure_That_The_Validation_Activity_Has_An_Error_Status.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.DocumentNotFoundInStorage_RecordsEvent.snap | Snapshot updated to include graphql.document.id on the event. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.Cause_A_Resolver_Error_That_Deletes_The_Whole_Result.snap | Snapshot updated to include document hash in error tags. |
| src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityExecutionDiagnosticListener.cs | Adds resolver-instrumentation toggle and enriches subscription error events with document info; tags document-not-found event. |
| src/HotChocolate/Diagnostics/src/Diagnostics/InstrumentationOptions.cs | Introduces EnableResolveFieldValue option (default true). |
| src/HotChocolate/Diagnostics/src/Diagnostics.Core/Spans/VariableCoercionSpan.cs | Marks variable-coercion span as error when coercion fails before committing variable values. |
| src/HotChocolate/Diagnostics/src/Diagnostics.Core/Spans/SubscriptionEventSpan.cs | Changes graphql.processing.type value for subscription events. |
| src/HotChocolate/Diagnostics/src/Diagnostics.Core/Spans/ExecuteRequestSpanBase.cs | Adds server address/port enrichment and propagates document info into emitted error events. |
| src/HotChocolate/Diagnostics/src/Diagnostics.Core/SemanticConventions.cs | Adds server.* semantic convention constants and subscription_event processing type. |
| src/HotChocolate/Diagnostics/src/Diagnostics.Core/Extensions/ActivityExtensions.cs | Enriches graphql.error events with operation + document info tags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 13, 2026
Closed
This was referenced May 21, 2026
This was referenced May 25, 2026
This was referenced Jun 4, 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.