Update message format to align with OTel spec completely#253
Merged
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the observability “gen_ai.*.messages” serialization and related helpers/tests to align the emitted message payloads more closely with the OpenTelemetry gen-ai semantic conventions (moving to a plain JSON array format and updating message model details).
Changes:
- Changed message wrapper serialization from a versioned object wrapper to a plain JSON array.
- Updated
OutputMessageto always provide afinish_reason(defaulting to"stop"). - Refreshed unit/integration tests to assert the new JSON array format.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Observability/Runtime/Tracing/MessageUtils.cs | Updates normalization/serialization docs and changes diagnostic fallback payload format. |
| src/Observability/Runtime/Tracing/Contracts/Messages/MessageWrappers.cs | Removes versioned wrapper surface and adds JSON converters to serialize wrappers as plain arrays. |
| src/Observability/Runtime/Tracing/Contracts/Messages/MessageTypes.cs | Makes finish_reason non-null and defaults it to "stop". |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/Tracing/Scopes/OutputScopeTest.cs | Updates assertions to expect JSON arrays for output messages. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/Tracing/Scopes/InvokeAgentScopeTest.cs | Updates assertions to expect JSON arrays for input/output messages. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/Tracing/Scopes/InferenceScopeTest.cs | Updates assertions to expect JSON arrays for input/output messages. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/Tracing/MessageUtilsTest.cs | Updates serialization tests to validate array-root JSON and finish_reason defaults. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/Etw/EtwLoggingBuilderTests.cs | Updates ETW attribute assertions for array-root message payloads. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/DTOs/Builders/OutputDataBuilderTests.cs | Updates output message attribute assertions for new format. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/DTOs/Builders/InvokeAgentDataBuilderTests.cs | Updates input/output message attribute assertions for new format. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/DTOs/Builders/ExecuteInferenceDataBuilderTests.cs | Updates input/output message attribute assertions for new format. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/DTOs/Builders/BaseDataBuilderTests.cs | Updates joined message attribute assertions for new format. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.IntegrationTests/Agent365ExporterE2ETests.cs | Updates E2E exporter assertions for input/output message payloads. |
| src/Tests/Microsoft.Agents.A365.Observability.Runtime.IntegrationTests/Agent365ExporterAsyncE2ETests.cs | Updates async E2E exporter assertions for input/output message payloads. |
| src/Tests/Microsoft.Agents.A365.Observability.Extensions.IntegrationTests/SemanticKernelSpanProcessorTests.cs | Updates SK span processor integration assertions for array-root messages. |
| src/Tests/Microsoft.Agents.A365.Observability.Extensions.IntegrationTests/SemanticKernelInvokeAgentPipelineTests.cs | Updates SK invoke-agent pipeline assertions for array-root messages. |
| src/Tests/Microsoft.Agents.A365.Observability.Extensions.IntegrationTests/AgentFrameworkSpanProcessorTests.cs | Updates Agent Framework processor assertions for array-root messages. |
| src/Tests/Microsoft.Agents.A365.Observability.Extensions.IntegrationTests/AgentFrameworkInvokeAgentPipelineTests.cs | Updates Agent Framework invoke-agent pipeline assertions for array-root messages. |
| src/Tests/Microsoft.Agents.A365.Observability.Extension.Tests/SemanticKernelSpanProcessorHelperTests.cs | Updates helper tests to assert JSON array payloads. |
The ChatWithToolCall_ProcessorMapsToolCallParts test was filtering spans by looking for 'version' in the input messages JSON. Since the envelope was removed, update the filter to check for array format instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
juliomenendez
approved these changes
May 20, 2026
fpfp100
approved these changes
May 20, 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.
Updates message format types and wrappers to fully align with the OpenTelemetry specification.
Changes