Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tracing): apiName determination with event listeners #2651

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

mxschmitt
Copy link
Member

The PR fixes an issue with incorrect apiName determination in tracing when using event listeners. Here's what was happening:

When using sync event listeners, the stack trace would include internal implementation details from the _impl_to_api_mapping module, which acts as glue between user code and internal code. We expect no other function between the implementation and the user call-side. This caused the API name to be incorrectly determined since these internal frames were being included in the stack analysis.

The key changes:

  • Added filtering to skip stack frames from _impl_to_api_mapping when extracting stack trace information
  • Added test cases for both sync and async event listeners to verify correct API name determination

The async case worked correctly because async event listeners only schedule asyncio.Tasks without maintaining the full stack trace.

Test Plan:

  • Added new test cases test_should_correctly_determine_sync_apiname for both sync and async implementations
  • Tests verify correct API action sequence in traces when using event listeners
  • Tested with response handlers making API calls like all_headers() and text()

Fixes #2650

@mxschmitt mxschmitt merged commit 1452881 into microsoft:main Nov 13, 2024
37 of 38 checks passed
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.

[Feature]:Request to Filter ImplToApiMapping.wrapper_func Entries in Playwright Trace Reports
2 participants