Request logging hooks #45442
alex-statsig
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the feature you'd like to request
I'd like the ability to add globally instrument my backend for requests. In particular, I'm surprised there seems to be no way to instrument static file serving. I would love to see how much my backend is having to serve static assets so I can prioritize a CDN appropriately.
Describe the solution you'd like
Ideally there would be a file (perhaps specified in next.config) where I could hook into backend performance instrumentation (primarily request counting / timing). There seems to exist something like this for the frontend (https://nextjs.org/docs/advanced-features/measuring-performance)
Describe alternatives you've considered
One alternative is simply creating my own reusable infrastructure for every page. We've already done that (in the form of a "NextController" template we use for every page). However, this does not extend to static resources, and is not elegantly baked into nextjs.
Another alternative is using middleware. However, that doesn't support the nodejs runtime, making it tricky to get our existing logging infrastructure to work in it.
Beta Was this translation helpful? Give feedback.
All reactions