@@ -26,11 +26,10 @@ import {
26
26
InstrumentationNodeModuleDefinition ,
27
27
safeExecuteInTheMiddle ,
28
28
} from '@opentelemetry/instrumentation' ;
29
- import { Pino , PinoInstrumentationConfig } from './types' ;
29
+ import { PinoInstrumentationConfig } from './types' ;
30
30
import { VERSION } from './version' ;
31
- import type { pino } from 'pino' ;
32
31
33
- const pinoVersions = [ '>=5.14.0 <8 ' ] ;
32
+ const pinoVersions = [ '>=5.14.0 <9 ' ] ;
34
33
35
34
export class PinoInstrumentation extends InstrumentationBase {
36
35
constructor ( config : PinoInstrumentationConfig = { } ) {
@@ -39,7 +38,7 @@ export class PinoInstrumentation extends InstrumentationBase {
39
38
40
39
protected init ( ) {
41
40
return [
42
- new InstrumentationNodeModuleDefinition < Pino > (
41
+ new InstrumentationNodeModuleDefinition < any > (
43
42
'pino' ,
44
43
pinoVersions ,
45
44
pinoModule => {
@@ -61,17 +60,22 @@ export class PinoInstrumentation extends InstrumentationBase {
61
60
args . splice ( 0 , 0 , {
62
61
mixin : instrumentation . _getMixinFunction ( ) ,
63
62
} ) ;
64
- return pinoModule ( ...( args as Parameters < Pino > ) ) ;
63
+ return pinoModule ( ...args ) ;
65
64
}
66
65
}
67
66
68
- args [ 0 ] = instrumentation . _combineOptions (
69
- args [ 0 ] as pino . LoggerOptions
70
- ) ;
67
+ args [ 0 ] = instrumentation . _combineOptions ( args [ 0 ] ) ;
71
68
72
- return pinoModule ( ...( args as Parameters < Pino > ) ) ;
69
+ return pinoModule ( ...args ) ;
73
70
} , pinoModule ) ;
74
71
72
+ if ( typeof patchedPino . pino === 'function' ) {
73
+ patchedPino . pino = patchedPino ;
74
+ }
75
+ if ( typeof patchedPino . default === 'function' ) {
76
+ patchedPino . default = patchedPino ;
77
+ }
78
+
75
79
return patchedPino ;
76
80
}
77
81
) ,
@@ -135,7 +139,7 @@ export class PinoInstrumentation extends InstrumentationBase {
135
139
} ;
136
140
}
137
141
138
- private _combineOptions ( options ?: pino . LoggerOptions ) {
142
+ private _combineOptions ( options ?: any ) {
139
143
if ( options === undefined ) {
140
144
return { mixin : this . _getMixinFunction ( ) } ;
141
145
}
0 commit comments