File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
packages/instrumentation-amqplib/src Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ import {
65
65
CONNECTION_ATTRIBUTES ,
66
66
getConnectionAttributesFromServer ,
67
67
getConnectionAttributesFromUrl ,
68
+ InstrumentationConnection ,
68
69
InstrumentationConsumeChannel ,
69
70
InstrumentationConsumeMessage ,
70
71
InstrumentationMessage ,
@@ -254,11 +255,11 @@ export class AmqplibInstrumentation extends InstrumentationBase<AmqplibInstrumen
254
255
this ,
255
256
url ,
256
257
socketOptions ,
257
- function ( this : unknown , err , conn : Connection ) {
258
+ function ( this : unknown , err , conn : InstrumentationConnection ) {
258
259
if ( err == null ) {
259
260
const urlAttributes = getConnectionAttributesFromUrl ( url ) ;
260
261
const serverAttributes = getConnectionAttributesFromServer ( conn ) ;
261
- ( conn as any ) [ CONNECTION_ATTRIBUTES ] = {
262
+ conn [ CONNECTION_ATTRIBUTES ] = {
262
263
...urlAttributes ,
263
264
...serverAttributes ,
264
265
} ;
Original file line number Diff line number Diff line change @@ -45,12 +45,15 @@ export const CONNECTION_ATTRIBUTES: unique symbol = Symbol(
45
45
'opentelemetry.amqplib.connection.attributes'
46
46
) ;
47
47
48
+ export type InstrumentationConnection = amqp . Connection & {
49
+ [ CONNECTION_ATTRIBUTES ] ?: Attributes ;
50
+ } ;
48
51
export type InstrumentationPublishChannel = (
49
52
| amqp . Channel
50
53
| amqp . ConfirmChannel
51
- ) & { connection : { [ CONNECTION_ATTRIBUTES ] : Attributes } } ;
54
+ ) & { connection : InstrumentationConnection } ;
52
55
export type InstrumentationConsumeChannel = amqp . Channel & {
53
- connection : { [ CONNECTION_ATTRIBUTES ] : Attributes } ;
56
+ connection : InstrumentationConnection ;
54
57
[ CHANNEL_SPANS_NOT_ENDED ] ?: {
55
58
msg : amqp . ConsumeMessage ;
56
59
timeOfConsume : HrTime ;
You can’t perform that action at this time.
0 commit comments