Add OpenTelemetry HTTP middleware - #513
Closed
heyitsaamir wants to merge 8 commits into
Closed
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 193946ff-3efa-4820-8e7d-0cea257aa1c2
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 193946ff-3efa-4820-8e7d-0cea257aa1c2
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 193946ff-3efa-4820-8e7d-0cea257aa1c2
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 193946ff-3efa-4820-8e7d-0cea257aa1c2
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 193946ff-3efa-4820-8e7d-0cea257aa1c2
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Collaborator
Author
|
Superseded by the Git Spice stack:\n\n1. API layer: https://github.com/microsoft/teams.py/pull/514\n2. Apps layer: https://github.com/microsoft/teams.py/pull/515\n3. Docs/examples layer: https://github.com/microsoft/teams.py/pull/516\n\nClosing this large PR so review can happen layer-by-layer. |
Collaborator
Author
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.
Adds the first cut of OpenTelemetry observability across the Python Teams SDK runtime.
Why
This gives developers a real trace through the SDK: inbound activity → handler → outbound Teams API call → auth. Makes it way easier to debug whether Teams called us, whether the handler ran, whether we sent the reply, and which auth flow was used.
It also sets up the Agent 365 story. Teams SDK spans are the useful diagnostic detail; Agent 365 product visibility still comes from explicit A365 scopes like invoke_agent / execute_tool / chat.
Interesting bits
microsoft.teams.api.client.microsoft.teams.auth.outboundfrom the API auth token callback.microsoft.teams.activity.processandmicrosoft.teams.handler.Microsoft.Teams.ApiandMicrosoft.Teams.Apps.service_url/agentic_identityscoping kwargs,HttpServerexports,skip_auth, and explicit/default Authorization header behavior after the middleware refactor.TS/Python intentionally differ from .NET right now: .NET still has Core-shaped names like
Microsoft.Teams.Core,turn, andconversation_client. This PR uses the newer API/Apps split andmicrosoft.teams.api.clientmiddleware model.Reviewer tips
Start with common HTTP middleware, then API outbound middleware, then conversation activity methods that attach semantic attrs/hooks. The compatibility commits are worth reviewing too: they preserve per-call service URL / agentic identity behavior and legacy app/http server surface.
Testing