File tree 2 files changed +11
-7
lines changed 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,7 @@ dist/bin/cli.js --d
308
308
# # Metrics
309
309
310
310
The client can optionally collect metrics using the Prometheus metrics platform and expose them via an HTTP endpoint with the following CLI flags.
311
- The current metrics that are reported by the client can be found [here](./src/util// metrics.ts) .
311
+ The current metrics that are reported by the client can be found at the default port and route: ` localhost:8000/ metrics` .
312
312
313
313
` ` ` sh
314
314
# npm installation
@@ -318,8 +318,6 @@ ethereumjs --prometheus
318
318
npm run client:start:ts -- --prometheus --prometheusPort=9123
319
319
` ` `
320
320
321
- Note: The Prometheus endpoint runs on port 8000 by default
322
-
323
321
# # API
324
322
325
323
[API Reference](./docs/README.md)
Original file line number Diff line number Diff line change @@ -1122,10 +1122,16 @@ async function run() {
1122
1122
const reqUrl = new url . URL ( req . url , `http://${ req . headers . host } ` )
1123
1123
const route = reqUrl . pathname
1124
1124
1125
- if ( route === '/metrics' ) {
1126
- // Return all metrics in the Prometheus exposition format
1127
- res . setHeader ( 'Content-Type' , register . contentType )
1128
- res . end ( await register . metrics ( ) )
1125
+ switch ( route ) {
1126
+ case '/metrics' :
1127
+ // Return all metrics in the Prometheus exposition format
1128
+ res . setHeader ( 'Content-Type' , register . contentType )
1129
+ res . end ( await register . metrics ( ) )
1130
+ break
1131
+ default :
1132
+ res . statusCode = 404
1133
+ res . end ( 'Not found' )
1134
+ return
1129
1135
}
1130
1136
} )
1131
1137
// Start the HTTP server which exposes the metrics on http://localhost:${args.prometheusPort}/metrics
You can’t perform that action at this time.
0 commit comments