Replies: 1 comment
-
|
This seems like something that should be considered for sure!! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Following up after a meeting with @pi0, we recently at Sentry built and
db0instrumentation in the Nuxt SDK and had some discussion on a better way to implement it with tracing channels.Current Solution: Monkey Patching
In the current solution we iterate over the defined database instances by reading the user config and instrument each database instance by monkey patching
.sql,.execand.prepare.Here is a snippet of the relevant parts:
This isn't ideal since the user can create other databases at runtime with
createDatabase.This solution is live right now in Nuxt SDK, and was going to be part of Nitro SDK which we shelved for now in order to see the outcome of making use of tracing channels around Nitro features first.
Proposal: Tracing Channels
Tracing channels are an experimental Node API that is available since
18.19and19.9and it is already being used by other libraries in the ecosystem.The main idea here is to fire events to an
db0tracing channel, something like this:Then subscribers, like an instrumentation SDK could potentially use it like so:
We can discuss the details here and work towards a good proposal for it.
Notes
.prepareis a bit unique, we may need to trace theStatementclass separately sinceprepareitself doesn't do async work, but rather itsall,runandgetmethods.Beta Was this translation helpful? Give feedback.
All reactions