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(remix): Export a manual wrapper for custom Express servers. #5524
Conversation
size-limit report 📦
|
eed4b8f
to
68a0569
Compare
We should be able to use |
68a0569
to
6fab0cb
Compare
@AbhiPrasad, the updated tests do not test the manual wrapper by itself. (As I could not recreate the scenario with the current testing structure). But they are testing when we use a manual wrapper on an already instrumented backend. |
@onurtemizkan That should be fine, we can also dogfood with vanguard to make sure we have added confidence. |
Great timing for my company as we are currently implementing Sentry in our newest app which happens to be using Remix (wrapped by express 😄). Looking forward to the next release! |
Awesome news @justinwaite - we’ll have a release out early next week! @onurtemizkan We’ll need to add some docs, can you take care of that? |
Remix allows custom server declarations and exports
createRequestHandler
functions from each adapter. In some cases,createRequestHandler
functions are used before we have a chance to instrument them.Auto-instrumentation wraps the core
createRequestHandler
from@remix/server-runtime
, which all the adapters use. Each adapter may have their own APIs, so we can't directly re-export our already implemented wrapper.This PR implements and exports a manual wrapper for Express adapters.
Also:
One thing I noticed:
A custom express server is still instrumented if it runs on the same thread as the runtime. For example, the tests run on a single Jest thread, and we can't reproduce this because of that.
If this wrapper is used when it's not needed,
loader
,action
anddocumentRequest
spans are reported twice. Is there a preferred way to prevent multiple wrapping? (I saw__sentry_wrapped__
but don't know if that's applicable here.)