Add middleware to baggage and output spans#209
Merged
nikhilNava merged 9 commits intomainfrom Mar 4, 2026
Merged
Conversation
Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
…ndling in test Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
...Microsoft.Agents.A365.Observability.Hosting.Tests/Middleware/OutputLoggingMiddlewareTests.cs
Dismissed
Show dismissed
Hide dismissed
src/Observability/Hosting/Middleware/OutputLoggingMiddleware.cs
Dismissed
Show dismissed
Hide dismissed
src/Observability/Hosting/Middleware/OutputLoggingMiddleware.cs
Dismissed
Show dismissed
Hide dismissed
src/Observability/Hosting/Middleware/OutputLoggingMiddleware.cs
Dismissed
Show dismissed
Hide dismissed
Copilot
AI
changed the title
[WIP] Implement baggage and output middleware
Add BaggageTurn and OutputLogging Bot Framework middleware
Mar 3, 2026
Dependency ReviewThe following issues were found:
License Issuessrc/Tests/Microsoft.Agents.A365.Observability.Hosting.Tests/Microsoft.Agents.A365.Observability.Hosting.Tests.csproj
OpenSSF Scorecard
Scanned Files
|
…ts and docs Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
Copilot
AI
changed the title
Add BaggageTurn and OutputLogging Bot Framework middleware
Add Bot Framework turn-level observability middleware with convenience registration
Mar 3, 2026
…d restore design.md Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
Copilot
AI
changed the title
Add Bot Framework turn-level observability middleware with convenience registration
Revert ObservabilityMiddlewareExtensions
Mar 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR appears to adjust the Observability Hosting surface area by adding Bot Framework middleware for OpenTelemetry baggage propagation and output span creation, along with corresponding unit tests and test dependencies.
Changes:
- Added
BaggageTurnMiddlewareto establish/dispose OpenTelemetry baggage per turn (skipping ContinueConversation events). - Added
OutputLoggingMiddlewareto createOutputScopespans for outgoing message activities and optionally link to a parent span. - Added/updated Hosting test project assets: new middleware unit tests and a
Moqpackage reference.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Observability/Hosting/Middleware/BaggageTurnMiddleware.cs | Adds Bot Framework middleware to set OpenTelemetry baggage derived from ITurnContext. |
| src/Observability/Hosting/Middleware/OutputLoggingMiddleware.cs | Adds Bot Framework middleware to create output tracing spans for sent message activities. |
| src/Tests/Microsoft.Agents.A365.Observability.Hosting.Tests/Middleware/BaggageTurnMiddlewareTests.cs | Adds unit tests covering baggage behavior and ContinueConversation skip behavior. |
| src/Tests/Microsoft.Agents.A365.Observability.Hosting.Tests/Middleware/OutputLoggingMiddlewareTests.cs | Adds unit tests verifying handler registration and pass-through behavior for missing context. |
| src/Tests/Microsoft.Agents.A365.Observability.Hosting.Tests/Microsoft.Agents.A365.Observability.Hosting.Tests.csproj | Adds Moq dependency needed by the new tests. |
...ts.A365.Observability.Hosting.Tests/Microsoft.Agents.A365.Observability.Hosting.Tests.csproj
Show resolved
Hide resolved
src/Observability/Hosting/Middleware/OutputLoggingMiddleware.cs
Outdated
Show resolved
Hide resolved
src/Observability/Hosting/Middleware/OutputLoggingMiddleware.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
juliomenendez
approved these changes
Mar 4, 2026
fpfp100
approved these changes
Mar 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.
Manual testing
Reverts the
UseObservabilityMiddlewareIChannelAdapter extension added in the previous commit, per author request.ObservabilityMiddlewareExtensions.csand its test filedesign.mdto its prior stateWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
agent365.svc.cloud.microsoft/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/Microsoft.Agents.A365.Observability.Runtime.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/Microsoft.Agents.A365.Observability.Runtime.Tests.deps.json /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/testhost.dll --port 46691 --endpoint 127.0.0.1:046691 --role client --parentprocessid 4310 --telemetryoptedin false(dns block)/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/Microsoft.Agents.A365.Observability.Runtime.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/Microsoft.Agents.A365.Observability.Runtime.Tests.deps.json /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/testhost.dll --port 44183 --endpoint 127.0.0.1:044183 --role client --parentprocessid 4967 --telemetryoptedin false(dns block)override.example.com/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/Microsoft.Agents.A365.Observability.Runtime.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/Microsoft.Agents.A365.Observability.Runtime.Tests.deps.json /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/testhost.dll --port 46691 --endpoint 127.0.0.1:046691 --role client --parentprocessid 4310 --telemetryoptedin false(dns block)/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/Microsoft.Agents.A365.Observability.Runtime.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/Microsoft.Agents.A365.Observability.Runtime.Tests.deps.json /home/REDACTED/work/Agent365-dotnet/Agent365-dotnet/src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/bin/Debug/net8.0/testhost.dll --port 44183 --endpoint 127.0.0.1:044183 --role client --parentprocessid 4967 --telemetryoptedin false(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.