diff --git a/api/accounts/accounts.go b/api/accounts/accounts.go index 1bd1959f6..27af71fbd 100644 --- a/api/accounts/accounts.go +++ b/api/accounts/accounts.go @@ -11,7 +11,7 @@ import ( "math/big" "net/http" "strconv" - + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/math" "github.com/gorilla/mux" diff --git a/api/api.go b/api/api.go index 3c116d11f..cddb2f5b4 100644 --- a/api/api.go +++ b/api/api.go @@ -55,7 +55,7 @@ func New( // to serve api docs if enableMetrics { - router.PathPrefix("/metrics").Handler(telemetry.Handler()) + router.PathPrefix("/node/metrics").Handler(telemetry.Handler()) } // to serve api doc and swagger-ui diff --git a/api/doc/thor.yaml b/api/doc/thor.yaml index cef06b475..65c117549 100644 --- a/api/doc/thor.yaml +++ b/api/doc/thor.yaml @@ -383,6 +383,33 @@ paths: schema: $ref: '#/components/schemas/GetPeersResponse' + /node/metrics: + get: + tags: + - Node + summary: Retrieve Prometheus metrics + description: | + This endpoint allows clients to retrieve Prometheus metrics. + responses: + '200': + description: Prometheus metrics response + content: + text/plain: + schema: + type: string + example: | + # HELP http_requests_total The total number of HTTP requests. + # TYPE http_requests_total counter + http_requests_total{method="GET",handler="/foo"} 100 + http_requests_total{method="POST",handler="/bar"} 200 + # HELP http_request_duration_seconds The duration of HTTP requests. + # TYPE http_request_duration_seconds histogram + http_request_duration_seconds_bucket{le="0.1"} 10 + http_request_duration_seconds_bucket{le="1"} 20 + http_request_duration_seconds_bucket{le="10"} 30 + http_request_duration_seconds_sum 123.45 + http_request_duration_seconds_count 60 + /subscriptions/block: get: tags: @@ -736,31 +763,6 @@ paths: type: string example: 'Invalid address' - /metrics: - get: - summary: Retrieve Prometheus metrics - description: | - This endpoint allows clients to retrieve Prometheus metrics. - responses: - '200': - description: Prometheus metrics response - content: - text/plain: - schema: - type: string - example: | - # HELP http_requests_total The total number of HTTP requests. - # TYPE http_requests_total counter - http_requests_total{method="GET",handler="/foo"} 100 - http_requests_total{method="POST",handler="/bar"} 200 - # HELP http_request_duration_seconds The duration of HTTP requests. - # TYPE http_request_duration_seconds histogram - http_request_duration_seconds_bucket{le="0.1"} 10 - http_request_duration_seconds_bucket{le="1"} 20 - http_request_duration_seconds_bucket{le="10"} 30 - http_request_duration_seconds_sum 123.45 - http_request_duration_seconds_count 60 - components: schemas: GetAccountResponse: