Skip to content

[Observability] Truncate spans larger than 250 KB#48

Merged
threddy merged 12 commits into
mainfrom
users/threddy/truncate-span
Nov 24, 2025
Merged

[Observability] Truncate spans larger than 250 KB#48
threddy merged 12 commits into
mainfrom
users/threddy/truncate-span

Conversation

@threddy

@threddy threddy commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@threddy
threddy requested a review from a team as a code owner November 7, 2025 20:30
Copilot AI review requested due to automatic review settings November 7, 2025 20:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TruncateActivityToMaxSize method to Agent365ExporterCore that 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\ncsharp\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n
using FluentAssertions;

Comment thread src/Observability/Runtime/Tracing/Exporters/Agent365ExporterCore.cs Outdated
Copilot AI review requested due to automatic review settings November 7, 2025 21:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/Observability/Runtime/Tracing/Exporters/Agent365ExporterCore.cs Outdated
Comment thread src/Observability/Runtime/Tracing/Exporters/Agent365ExporterCore.cs Outdated
Comment thread src/Observability/Runtime/Tracing/Exporters/Agent365ExporterCore.cs Outdated
@threddy
threddy requested a review from a team as a code owner November 21, 2025 18:37
Comment thread src/Observability/Runtime/Common/ExportFormatter.cs Outdated
Comment thread src/Observability/Runtime/Common/ExportFormatter.cs
Copilot AI review requested due to automatic review settings November 21, 2025 19:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread src/Observability/Runtime/Common/ExportFormatter.cs
Comment thread src/Observability/Runtime/Common/ExportFormatter.cs
juliomenendez
juliomenendez previously approved these changes Nov 21, 2025
Comment thread src/Observability/Runtime/Tracing/Scopes/OpenTelemetryConstants.cs Outdated
Copilot AI review requested due to automatic review settings November 24, 2025 17:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

@threddy
threddy merged commit 08e59a5 into main Nov 24, 2025
11 checks passed
@nikhilNava
nikhilNava deleted the users/threddy/truncate-span branch November 24, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants