Skip to content

Conversation

@LukeMaisel
Copy link

Overview

Previously, the _create_observability_span method in the BaseMiddleware would return the current span if no parent_span was given in the request options. Since everything that uses this method treats the returned value as a newly created span, this led to unintentionally modifying and/or ending outside spans that are not directly a part of the middleware/kiota.

I updated this method to, in the event no parent_span is given in the request, create a new span with the middleware's parent_span context or with the current context if needed. This ensures the returned span was created by the method no matter the context.

I also added another test for BaseMiddleware that ensures BaseMiddleware does not end outer spans.

Related Issue

N/A

Testing Instructions

  • New and modified tests pass
  • Other test results identical to main branch

…rning the current span

Updated _create_observability_span to create a new span with the middleware's parent_span context or current context if needed.
Updated BaseMiddleware tests to be more accurate and ensure BaseMiddleware does not end outer spans.
@LukeMaisel LukeMaisel requested a review from a team as a code owner August 20, 2025 21:44
@sonarqubecloud
Copy link

@LukeMaisel
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@github-project-automation github-project-automation bot moved this to In Progress 🚧 in Kiota Aug 21, 2025
@baywet baywet enabled auto-merge August 21, 2025 12:33
@baywet baywet merged commit 8ad6559 into microsoft:main Aug 21, 2025
52 checks passed
@github-project-automation github-project-automation bot moved this from In Progress 🚧 to Done ✔️ in Kiota Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants