@@ -127,6 +127,8 @@ export class Upgrader implements UpgraderInterface {
127
127
private readonly metrics : {
128
128
dials ?: CounterGroup < 'inbound' | 'outbound' >
129
129
errors ?: CounterGroup < 'inbound' | 'outbound' >
130
+ inboundErrors ?: CounterGroup
131
+ outboundErrors ?: CounterGroup
130
132
}
131
133
132
134
constructor ( components : UpgraderComponents , init : UpgraderInit ) {
@@ -155,7 +157,9 @@ export class Upgrader implements UpgraderInterface {
155
157
this . events = components . events
156
158
this . metrics = {
157
159
dials : components . metrics ?. registerCounterGroup ( 'libp2p_connection_manager_dials_total' ) ,
158
- errors : components . metrics ?. registerCounterGroup ( 'libp2p_connection_manager_dial_errors_total' )
160
+ errors : components . metrics ?. registerCounterGroup ( 'libp2p_connection_manager_dial_errors_total' ) ,
161
+ inboundErrors : components . metrics ?. registerCounterGroup ( 'libp2p_connection_manager_dials_inbound_errors_total' ) ,
162
+ outboundErrors : components . metrics ?. registerCounterGroup ( 'libp2p_connection_manager_dials_outbound_errors_total' )
159
163
}
160
164
}
161
165
@@ -213,10 +217,13 @@ export class Upgrader implements UpgraderInterface {
213
217
...opts ,
214
218
signal
215
219
} )
216
- } catch ( err ) {
220
+ } catch ( err : any ) {
217
221
this . metrics . errors ?. increment ( {
218
222
inbound : true
219
223
} )
224
+ this . metrics . inboundErrors ?. increment ( {
225
+ [ err . name ?? 'Error' ] : true
226
+ } )
220
227
221
228
throw err
222
229
} finally {
@@ -253,10 +260,13 @@ export class Upgrader implements UpgraderInterface {
253
260
}
254
261
255
262
return await this . _performUpgrade ( maConn , direction , opts )
256
- } catch ( err ) {
263
+ } catch ( err : any ) {
257
264
this . metrics . errors ?. increment ( {
258
265
outbound : true
259
266
} )
267
+ this . metrics . outboundErrors ?. increment ( {
268
+ [ err . name ?? 'Error' ] : true
269
+ } )
260
270
261
271
throw err
262
272
}
0 commit comments