File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 88
88
"@opentelemetry/resources" : " ^1.25.1" ,
89
89
"@opentelemetry/sdk-trace-base" : " ^1.25.1" ,
90
90
"@opentelemetry/semantic-conventions" : " ^1.25.1" ,
91
+ "@opentelemetry/instrumentation-generic-pool" : " ^0.38.0" ,
91
92
"@prisma/instrumentation" : " 5.17.0" ,
92
93
"@sentry/core" : " 8.25.0" ,
93
94
"@sentry/opentelemetry" : " 8.25.0" ,
Original file line number Diff line number Diff line change
1
+ import { GenericPoolInstrumentation } from '@opentelemetry/instrumentation-generic-pool' ;
2
+ import { defineIntegration , SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , spanToJSON } from '@sentry/core' ;
3
+ import type { IntegrationFn } from '@sentry/types' ;
4
+ import { generateInstrumentOnce } from '../../otel/instrument' ;
5
+
6
+ const INTEGRATION_NAME = 'GenericPool' ;
7
+
8
+ export const instrumentGenericPool = generateInstrumentOnce ( INTEGRATION_NAME , ( ) => new GenericPoolInstrumentation ( { } ) ) ;
9
+
10
+ const _genericPoolIntegration = ( ( ) => {
11
+ return {
12
+ name : INTEGRATION_NAME ,
13
+ setupOnce ( ) {
14
+ instrumentGenericPool ( ) ;
15
+ } ,
16
+
17
+ setup ( client ) {
18
+ client . on ( 'spanStart' , span => {
19
+ const spanJSON = spanToJSON ( span ) ;
20
+ if ( spanJSON . description === 'generic-pool.acquire' ) {
21
+ span . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , 'auto.db.otel.generic-pool' ) ;
22
+ }
23
+ } ) ;
24
+ } ,
25
+ } ;
26
+ } ) satisfies IntegrationFn ;
27
+
28
+ /**
29
+ * GenericPool integration
30
+ *
31
+ * Capture tracing data for GenericPool.
32
+ */
33
+ export const genericPoolIntegration = defineIntegration ( _genericPoolIntegration ) ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { instrumentMysql2, mysql2Integration } from './mysql2';
14
14
import { instrumentNest , nestIntegration } from './nest/nest' ;
15
15
import { instrumentPostgres , postgresIntegration } from './postgres' ;
16
16
import { instrumentRedis , redisIntegration } from './redis' ;
17
+ import { instrumentGenericPool , genericPoolIntegration } from './genericPool'
17
18
18
19
/**
19
20
* With OTEL, all performance integrations will be added, as OTEL only initializes them when the patched package is actually required.
@@ -37,6 +38,7 @@ export function getAutoPerformanceIntegrations(): Integration[] {
37
38
hapiIntegration ( ) ,
38
39
koaIntegration ( ) ,
39
40
connectIntegration ( ) ,
41
+ genericPoolIntegration ( ) ,
40
42
] ;
41
43
}
42
44
@@ -61,5 +63,6 @@ export function getOpenTelemetryInstrumentationToPreload(): (((options?: any) =>
61
63
instrumentHapi ,
62
64
instrumentGraphql ,
63
65
instrumentRedis ,
66
+ instrumentGenericPool ,
64
67
] ;
65
68
}
You can’t perform that action at this time.
0 commit comments