Repository navigation
Conversation
Co-Authored-By: Cursor Agent <cursoragent@cursor.com>
JonasBa
marked this pull request as ready for review
November 20, 2026 18:05
javascript-sdk-gitflow
Bot
requested review from
andreiborza,
isaacs and
timfish
November 20, 2026 18:05
This branch has not been deployed
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.
What
On unsampled requests, the Fastify integration no longer starts a span for each hook and for the route handler. Hooks and handlers run as before, with the same
this, arguments, return values and errors. Sampled requests produce the same spans as before.Why
On an unsampled request, every hook span is a non-recording span that is never sent, but each one still forks the scope, sets an active span and builds its attributes, so apps with many hooks pay for it on every request. The check uses
spanIsSampled, which is howstartSpandecides a child's sampling, rather thanisRecording():onResponsehooks run after the request span has ended and fall back to the active span, and an ended sampled span is not recording. Tradeoff: the skipped spans no longer record asample_rateclient outcome.Fastify 5.12, 20 no-op async instance hooks (5 each on
onRequest,preHandler,onSendandonResponse),app.inject()in a loop with the AsyncLocalStorage context strategy, median of 7 runs of 20,000 requests, Node 26 on an M4 Pro:tracesSampleRate0develop01develop1Closes: #26710