René's URL Explorer Experiment


Title: feat(core): Associate resource/tool/prompt invocations with request span instead of response span by lforst · Pull Request #16126 · getsentry/sentry-javascript · GitHub

Open Graph Title: feat(core): Associate resource/tool/prompt invocations with request span instead of response span by lforst · Pull Request #16126 · getsentry/sentry-javascript

X Title: feat(core): Associate resource/tool/prompt invocations with request span instead of response span by lforst · Pull Request #16126 · getsentry/sentry-javascript

Description: This PR adds a best effor mechanism to associate handler spans for resource, tool and prompt with the incoming message requests instead of the outgoing SSE response. The work is based on the upstream PR which exposes the request id on the handler metadata: modelcontextprotocol/typescript-sdk#358 This PR actually also fixes a bug where we were instrumenting the registering of the handler instead of the actual handler 🤦‍♂️. One thing to note in this PR is that it has a risk of being slightly memory leaky. We are storing away spans by session and request id and cleaning them up when they are used. In the case of long lived sessions the span will not be garbage collected for a long time. There is unfortunately no way of doing a weak reference because session id and request ids are primitives and the framework doesn't give us any identity objects to cross-reference stuff with.

Open Graph Description: This PR adds a best effor mechanism to associate handler spans for resource, tool and prompt with the incoming message requests instead of the outgoing SSE response. The work is based on the upstre...

X Description: This PR adds a best effor mechanism to associate handler spans for resource, tool and prompt with the incoming message requests instead of the outgoing SSE response. The work is based on the upstre...

Opengraph URL: https://github.com/getsentry/sentry-javascript/pull/16126

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e2cf7201-609c-586c-3f6e-9d2b24d42de8
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE550:1B10FF:254382F:310C578:6B0552DB
html-safe-nonce458aaa9b626f86d7aa8c432ec56cf24639370724975ada1fcd82ced97a6989cf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTUwOjFCMTBGRjoyNTQzODJGOjMxMEM1Nzg6NkIwNTUyREIiLCJ2aXNpdG9yX2lkIjoiMjg3ODEyODY5ODYxODYzMDg3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf74872b0b4fe30e2e0d69e3cdd781a79ee8da15bd42054e4fc276225b68d0e98
hovercard-subject-tagpull_request:2478901883
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/getsentry/sentry-javascript/pull/16126/files
twitter:imagehttps://avatars.githubusercontent.com/u/8118419?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/8118419?s=400&v=4
og:image:altThis PR adds a best effor mechanism to associate handler spans for resource, tool and prompt with the incoming message requests instead of the outgoing SSE response. The work is based on the upstre...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release220e980097d94ce616d5d11fbd5316d208e3fc93
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/pull/16126/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fpull%2F16126%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fpull%2F16126%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/pull/16126/files
Reloadhttps://github.com/getsentry/sentry-javascript/pull/16126/files
Reloadhttps://github.com/getsentry/sentry-javascript/pull/16126/files
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues334 (334)https://github.com/getsentry/sentry-javascript/issues
Pull requests53 (53)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgetsentry%2Fsentry-javascript%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgetsentry%2Fsentry-javascript%2Fissues%2Fnew%2Fchoose
lforsthttps://github.com/lforst
develophttps://github.com/getsentry/sentry-javascript/tree/develop
lforst-mcp-trace-associationhttps://github.com/getsentry/sentry-javascript/tree/lforst-mcp-trace-association
Conversation 2 https://github.com/getsentry/sentry-javascript/pull/16126
Commits 4 https://github.com/getsentry/sentry-javascript/pull/16126/commits
Checks 0 https://github.com/getsentry/sentry-javascript/pull/16126/checks
Files changed https://github.com/getsentry/sentry-javascript/pull/16126/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/16126/files
feat(core): Associate resource/tool/prompt invocations with request span instead of response span https://github.com/getsentry/sentry-javascript/pull/16126/files#top
Show all changes 4 commits https://github.com/getsentry/sentry-javascript/pull/16126/files
32fa70a feat(core): Associate resource/tool/prompt invocations with request s… Apr 24, 2025 https://github.com/getsentry/sentry-javascript/pull/16126/commits/32fa70a6122f95f31df7f46b976a2063d57baa9f
46d46d8 Add tests Apr 24, 2025 https://github.com/getsentry/sentry-javascript/pull/16126/commits/46d46d8abb76da254c19e9259bb0f45c397e4596
45975e6 Update tests Apr 25, 2025 https://github.com/getsentry/sentry-javascript/pull/16126/commits/45975e636360f9df7df92eb623370071d61f1dce
a6b5915 Update mcp.test.ts Apr 25, 2025 https://github.com/getsentry/sentry-javascript/pull/16126/commits/a6b59159a5e5e278063db8b78f145841ed3f3897
Clear filters https://github.com/getsentry/sentry-javascript/pull/16126/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/16126/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/16126/files
package.json https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-3605d208ddbf11f06ab0a01b2a80d5b553ffaa2a3d53d265bdaab8383e5ca2fb
app.ts https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-b56089c565c003e44978d68a8e7b37175246d3b6c1030eb3cdae4954ca63bf5c
mcp.ts https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-2134d0405d2a9a93a338cef871e873fe96144ae70453a76e7767ef3a2b7ca323
mcp.test.ts https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-9726d2222fe4a8de0003651035b2a803f06e0c2a17de29e6718cc5621a6bd408
tsconfig.json https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-610f3d8c56769d7021a6683116fde0da7664b4af44969e135f8921903db78c6a
mcp-server.ts https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-afff7f07424f41e65bf2b8f08599df7bfa3edd6a351c5b999dbad9e25087c55e
mcp-server.test.ts https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-d511b73cce5812fb80b6b79da84c553cc9ea66f09b603e50c99dd5758889fe65
dev-packages/e2e-tests/test-applications/node-express/package.jsonhttps://github.com/getsentry/sentry-javascript/pull/16126/files#diff-3605d208ddbf11f06ab0a01b2a80d5b553ffaa2a3d53d265bdaab8383e5ca2fb
View file https://github.com/getsentry/sentry-javascript/blob/a6b59159a5e5e278063db8b78f145841ed3f3897/dev-packages/e2e-tests/test-applications/node-express/package.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/16126/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-3605d208ddbf11f06ab0a01b2a80d5b553ffaa2a3d53d265bdaab8383e5ca2fb
https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-3605d208ddbf11f06ab0a01b2a80d5b553ffaa2a3d53d265bdaab8383e5ca2fb
https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-3605d208ddbf11f06ab0a01b2a80d5b553ffaa2a3d53d265bdaab8383e5ca2fb
dev-packages/e2e-tests/test-applications/node-express/src/app.tshttps://github.com/getsentry/sentry-javascript/pull/16126/files#diff-b56089c565c003e44978d68a8e7b37175246d3b6c1030eb3cdae4954ca63bf5c
View file https://github.com/getsentry/sentry-javascript/blob/a6b59159a5e5e278063db8b78f145841ed3f3897/dev-packages/e2e-tests/test-applications/node-express/src/app.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/16126/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-b56089c565c003e44978d68a8e7b37175246d3b6c1030eb3cdae4954ca63bf5c
https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-b56089c565c003e44978d68a8e7b37175246d3b6c1030eb3cdae4954ca63bf5c
dev-packages/e2e-tests/test-applications/node-express/src/mcp.tshttps://github.com/getsentry/sentry-javascript/pull/16126/files#diff-2134d0405d2a9a93a338cef871e873fe96144ae70453a76e7767ef3a2b7ca323
View file https://github.com/getsentry/sentry-javascript/blob/a6b59159a5e5e278063db8b78f145841ed3f3897/dev-packages/e2e-tests/test-applications/node-express/src/mcp.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/16126/{{ revealButtonHref }}
dev-packages/e2e-tests/test-applications/node-express/tests/mcp.test.tshttps://github.com/getsentry/sentry-javascript/pull/16126/files#diff-9726d2222fe4a8de0003651035b2a803f06e0c2a17de29e6718cc5621a6bd408
View file https://github.com/getsentry/sentry-javascript/blob/a6b59159a5e5e278063db8b78f145841ed3f3897/dev-packages/e2e-tests/test-applications/node-express/tests/mcp.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/16126/{{ revealButtonHref }}
dev-packages/e2e-tests/test-applications/node-express/tsconfig.jsonhttps://github.com/getsentry/sentry-javascript/pull/16126/files#diff-610f3d8c56769d7021a6683116fde0da7664b4af44969e135f8921903db78c6a
View file https://github.com/getsentry/sentry-javascript/blob/a6b59159a5e5e278063db8b78f145841ed3f3897/dev-packages/e2e-tests/test-applications/node-express/tsconfig.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/16126/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/16126/files#diff-610f3d8c56769d7021a6683116fde0da7664b4af44969e135f8921903db78c6a
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/16126/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.