[Observability] Truncate spans larger than 250 KB#48
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to truncate large activity payloads before exporting them to the Agent365 endpoint. The main purpose is to prevent exporting activities that exceed 250 KB by truncating the largest attribute values first.
Key changes:
- Added a
TruncateActivityToMaxSizemethod toAgent365ExporterCorethat progressively truncates large activity attributes (largest first) until the serialized size is under 250 KB - Integrated truncation logic into the export pipeline to automatically truncate activities before serialization
- Added comprehensive unit tests and an end-to-end integration test to validate the truncation behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Agent365ExporterCore.cs | Implements the core truncation logic with size checking, attribute truncation (largest-first), and logging; integrates truncation into the export batch pipeline |
| Agent365ExporterTests.cs | Adds four unit tests covering scenarios: activities under limit, single large key truncation, multiple key truncation, and key size logging; removes unused using statement |
| Agent365ExporterE2ETests.cs | Adds an integration test that creates a 300KB file payload and validates that nested scopes correctly truncate the large tool arguments while preserving smaller attributes |
Comments suppressed due to low confidence (1)
src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/Tracing/Exporters/Agent365ExporterTests.cs:1
- Missing required Microsoft copyright header. Please add the following header at the top of the file before any using statements:\n\n
csharp\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n
using FluentAssertions;
nikhilNava
requested changes
Nov 13, 2025
juliomenendez
requested changes
Nov 21, 2025
juliomenendez
requested changes
Nov 21, 2025
juliomenendez
previously approved these changes
Nov 21, 2025
nikhilNava
requested changes
Nov 23, 2025
nikhilNava
approved these changes
Nov 24, 2025
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.