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

feat(instrumentation-express): propagate context and measure full handler spans #2638

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raphael-theriault-swi
Copy link
Contributor

Which problem is this PR solving?

Currently the Express instrumentation does not propagate context and does not properly instrument request handlers.

Short description of the changes

Context is propagated for middleware and request handler spans, while their next callback is reset to the parent context to avoid extreme nesting as suggested in #2022. Request handler spans are also no longer ended prematurely.

Router spans are kept as-is since they are broken and propagating context for them would make things even more confusing than they already are.

Example traces

Before

example trace before the changes

After

example trace after the changes

Related issues

@raphael-theriault-swi
Copy link
Contributor Author

cc @pichlermarc fixes discussed wednesday

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.79%. Comparing base (12ee8db) to head (8d6662f).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2638   +/-   ##
=======================================
  Coverage   90.78%   90.79%           
=======================================
  Files         169      169           
  Lines        8056     8062    +6     
  Branches     1643     1645    +2     
=======================================
+ Hits         7314     7320    +6     
  Misses        742      742           
Files with missing lines Coverage Δ
...try-instrumentation-express/src/instrumentation.ts 98.61% <100.00%> (+0.02%) ⬆️

... and 1 file with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment