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 {
6565 CONNECTION_ATTRIBUTES ,
6666 getConnectionAttributesFromServer ,
6767 getConnectionAttributesFromUrl ,
68+ InstrumentationConnection ,
6869 InstrumentationConsumeChannel ,
6970 InstrumentationConsumeMessage ,
7071 InstrumentationMessage ,
@@ -254,11 +255,11 @@ export class AmqplibInstrumentation extends InstrumentationBase<AmqplibInstrumen
254255 this ,
255256 url ,
256257 socketOptions ,
257- function ( this : unknown , err , conn : Connection ) {
258+ function ( this : unknown , err , conn : InstrumentationConnection ) {
258259 if ( err == null ) {
259260 const urlAttributes = getConnectionAttributesFromUrl ( url ) ;
260261 const serverAttributes = getConnectionAttributesFromServer ( conn ) ;
261- ( conn as any ) [ CONNECTION_ATTRIBUTES ] = {
262+ conn [ CONNECTION_ATTRIBUTES ] = {
262263 ...urlAttributes ,
263264 ...serverAttributes ,
264265 } ;
Original file line number Diff line number Diff line change @@ -45,12 +45,15 @@ export const CONNECTION_ATTRIBUTES: unique symbol = Symbol(
4545 'opentelemetry.amqplib.connection.attributes'
4646) ;
4747
48+ export type InstrumentationConnection = amqp . Connection & {
49+ [ CONNECTION_ATTRIBUTES ] ?: Attributes ;
50+ } ;
4851export type InstrumentationPublishChannel = (
4952 | amqp . Channel
5053 | amqp . ConfirmChannel
51- ) & { connection : { [ CONNECTION_ATTRIBUTES ] : Attributes } } ;
54+ ) & { connection : InstrumentationConnection } ;
5255export type InstrumentationConsumeChannel = amqp . Channel & {
53- connection : { [ CONNECTION_ATTRIBUTES ] : Attributes } ;
56+ connection : InstrumentationConnection ;
5457 [ CHANNEL_SPANS_NOT_ENDED ] ?: {
5558 msg : amqp . ConsumeMessage ;
5659 timeOfConsume : HrTime ;
You can’t perform that action at this time.
0 commit comments