@@ -5,7 +5,7 @@ import { NetworkId, NetworkNames } from '../networks/types.js'
55import type { PortalNetworkMetrics } from '../client/types.js'
66
77const peers = ( networks : NetworkId [ ] ) => {
8- const metrics : Record < string , PromClient . Gauge > = { }
8+ const metrics : Record < string , PromClient . Gauge < NetworkId > > = { }
99 for ( const network of networks ) {
1010 const name = NetworkNames [ network ]
1111 metrics [ name + '_peers' ] = new PromClient . Gauge ( {
@@ -19,8 +19,12 @@ const peers = (networks: NetworkId[]) => {
1919export const setupMetrics = (
2020 networks : NetworkId [ ] = [ NetworkId . HistoryNetwork ] ,
2121) : PortalNetworkMetrics => {
22+ const peerMetrics = peers ( networks ) as Record <
23+ keyof PortalNetworkMetrics ,
24+ PromClient . Gauge < NetworkId >
25+ >
2226 return {
23- ...peers ( networks ) ,
27+ ...peerMetrics ,
2428 totalContentLookups : new PromClient . Gauge < string > ( {
2529 name : 'ultralight_total_content_lookups' ,
2630 help : 'total number of content lookups initiated' ,
@@ -93,5 +97,5 @@ export const setupMetrics = (
9397 name : 'ultralight_db_size' ,
9498 help : 'how many MBs are currently stored in the db' ,
9599 } ) ,
96- } as unknown as PortalNetworkMetrics
100+ }
97101}
0 commit comments