File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ export { denoMysqlIntegration } from './integrations/mysql';
115115export { denoPostgresIntegration } from './integrations/postgres' ;
116116export { denoAmqplibIntegration } from './integrations/amqplib' ;
117117export { denoDataloaderIntegration } from './integrations/dataloader' ;
118+ export { denoKnexIntegration } from './integrations/knex' ;
118119export { denoContextIntegration } from './integrations/context' ;
119120export { globalHandlersIntegration } from './integrations/globalhandlers' ;
120121export { normalizePathsIntegration } from './integrations/normalizepaths' ;
Original file line number Diff line number Diff line change 1+ import { knexChannelIntegration } from '@sentry/server-utils/orchestrion' ;
2+ import type { Integration , IntegrationFn } from '@sentry/core' ;
3+ import { defineIntegration , extendIntegration } from '@sentry/core' ;
4+ import { setAsyncLocalStorageAsyncContextStrategy } from '../async' ;
5+
6+ const INTEGRATION_NAME = 'DenoKnex' as const ;
7+
8+ /**
9+ * Create spans for `knex` queries under Deno.
10+ *
11+ * `knex` channels are injected by the orchestrion runtime hook at load time.
12+ * The `@sentry/deno/import` loader must be active for this integration to
13+ * record anything.
14+ *
15+ * The channel-subscription logic is shared with the other server runtimes in
16+ * `@sentry/server-utils`. This just installs Deno's
17+ * `AsyncLocalStorage` context strategy (so spans nest under the active
18+ * span and survive knex's internal callback dispatch) before delegating.
19+ */
20+ const _denoKnexIntegration = ( ( ) => {
21+ const inner = knexChannelIntegration ( ) ;
22+
23+ return extendIntegration ( inner , {
24+ name : INTEGRATION_NAME ,
25+ setupOnce ( ) {
26+ setAsyncLocalStorageAsyncContextStrategy ( ) ;
27+ } ,
28+ } ) ;
29+ } ) satisfies IntegrationFn ;
30+
31+ export const denoKnexIntegration = defineIntegration ( _denoKnexIntegration ) as ( ) => Integration & {
32+ name : 'DenoKnex' ;
33+ setupOnce : ( ) => void ;
34+ } ;
You can’t perform that action at this time.
0 commit comments