feat(hono): Add hono.request spans for internal .request() calls#20843
Open
s1gr1d wants to merge 4 commits into
Open
feat(hono): Add hono.request spans for internal .request() calls#20843s1gr1d wants to merge 4 commits into
hono.request spans for internal .request() calls#20843s1gr1d wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
size-limit report 📦
|
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.
Hono apps commonly use sub-apps and fetch data between them via
.request(), but these internal calls were invisible in traces. This PR addshono.requestchild spans so users can see the full picture when one Hono app calls another internally (single, parallel, or sequential calls).Also restructures the route hook into two-phases: sub-app references are collected at import time and instrumented when
sentry()activates. This ensures sub-apps mounted beforesentry()is registered aren't silently missed (without generating any spans or overhead if Sentry is never initialized).Step-by-step description:
@sentry/hono,earlyPatchHono()runs at module load time and hooksHonoBase.prototype.route. Any sub-app passed to.route()from this point on is collected into a pending set (but not yet instrumented).app.route('/prefix', subApp). Sub-apps are silently collected by the hook.app.use(sentry()), which callsapplyPatches(app).applyPatchespatchesapp.useon the main app instance (viaProxy) so all future middleware registrations are wrapped in spans.applyPatchespatchesapp.requeston the main app instance so internal.request()calls (for fetches) are traced ashono.requestspans..route()from now on is instrumented immediately at mount time.sentry()) are drained and retroactively instrumented: their middleware is wrapped in spans and their.request()is patched.Closes #20807