Skip to content

Commit

Permalink
chore: update API metrics bucket and endpoint names
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Nov 25, 2024
1 parent 221b69c commit 140bf5c
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 18 deletions.
12 changes: 6 additions & 6 deletions api/accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,27 +358,27 @@ func (a *Accounts) Mount(root *mux.Router, pathPrefix string) {

sub.Path("/*").
Methods(http.MethodPost).
Name("accounts_call_batch_code").
Name("POST /accounts/*").
HandlerFunc(utils.WrapHandlerFunc(a.handleCallBatchCode))
sub.Path("/{address}").
Methods(http.MethodGet).
Name("accounts_get_account").
Name("GET /accounts/{address}").
HandlerFunc(utils.WrapHandlerFunc(a.handleGetAccount))
sub.Path("/{address}/code").
Methods(http.MethodGet).
Name("accounts_get_code").
Name("GET /accounts/{address}/code").
HandlerFunc(utils.WrapHandlerFunc(a.handleGetCode))
sub.Path("/{address}/storage/{key}").
Methods("GET").
Name("accounts_get_storage").
Name("GET /accounts/{address}/storage").
HandlerFunc(utils.WrapHandlerFunc(a.handleGetStorage))
// These two methods are currently deprecated
sub.Path("").
Methods(http.MethodPost).
Name("accounts_call_contract").
Name("POST /accounts").
HandlerFunc(utils.WrapHandlerFunc(a.handleCallContract))
sub.Path("/{address}").
Methods(http.MethodPost).
Name("accounts_call_contract_address").
Name("POST /accounts/{address}").
HandlerFunc(utils.WrapHandlerFunc(a.handleCallContract))
}
2 changes: 1 addition & 1 deletion api/blocks/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ func (b *Blocks) Mount(root *mux.Router, pathPrefix string) {
sub := root.PathPrefix(pathPrefix).Subrouter()
sub.Path("/{revision}").
Methods(http.MethodGet).
Name("blocks_get_block").
Name("GET /blocks/{revision}").
HandlerFunc(utils.WrapHandlerFunc(b.handleGetBlock))
}
6 changes: 3 additions & 3 deletions api/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ func (d *Debug) Mount(root *mux.Router, pathPrefix string) {

sub.Path("/tracers").
Methods(http.MethodPost).
Name("debug_trace_clause").
Name("POST /debug/tracers").
HandlerFunc(utils.WrapHandlerFunc(d.handleTraceClause))
sub.Path("/tracers/call").
Methods(http.MethodPost).
Name("debug_trace_call").
Name("POST /debug/tracers/call").
HandlerFunc(utils.WrapHandlerFunc(d.handleTraceCall))
sub.Path("/storage-range").
sub.Path("POST /debug/storage-range").
Methods(http.MethodPost).
Name("debug_trace_storage").
HandlerFunc(utils.WrapHandlerFunc(d.handleDebugStorage))
Expand Down
2 changes: 1 addition & 1 deletion api/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ func (e *Events) Mount(root *mux.Router, pathPrefix string) {

sub.Path("").
Methods(http.MethodPost).
Name("logs_filter_event").
Name("POST /logs/event").
HandlerFunc(utils.WrapHandlerFunc(e.handleFilter))
}
2 changes: 1 addition & 1 deletion api/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func metricsMiddleware(next http.Handler) http.Handler {
name = ""
subscription = ""
)

// all named route will be recorded
if rt != nil && rt.GetName() != "" {
enabled = true
Expand Down
2 changes: 1 addition & 1 deletion api/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ func (n *Node) Mount(root *mux.Router, pathPrefix string) {

sub.Path("/network/peers").
Methods(http.MethodGet).
Name("node_get_peers").
Name("GET /node/network/peers").
HandlerFunc(utils.WrapHandlerFunc(n.handleNetwork))
}
6 changes: 3 additions & 3 deletions api/transactions/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ func (t *Transactions) Mount(root *mux.Router, pathPrefix string) {

sub.Path("").
Methods(http.MethodPost).
Name("transactions_send_tx").
Name("POST /transactions").
HandlerFunc(utils.WrapHandlerFunc(t.handleSendTransaction))
sub.Path("/{id}").
Methods(http.MethodGet).
Name("transactions_get_tx").
Name("GET /transactions/${id}").
HandlerFunc(utils.WrapHandlerFunc(t.handleGetTransactionByID))
sub.Path("/{id}/receipt").
Methods(http.MethodGet).
Name("transactions_get_receipt").
Name("GET /transactions/${id}/receipt").
HandlerFunc(utils.WrapHandlerFunc(t.handleGetTransactionReceiptByID))
}
2 changes: 1 addition & 1 deletion api/transfers/transfers.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ func (t *Transfers) Mount(root *mux.Router, pathPrefix string) {

sub.Path("").
Methods(http.MethodPost).
Name("logs_filter_transfer").
Name("POST /logs/transfer").
HandlerFunc(utils.WrapHandlerFunc(t.handleFilterTransferLogs))
}
6 changes: 5 additions & 1 deletion metrics/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ func HTTPHandler() http.Handler {
// Define standard buckets for histograms
var (
Bucket10s = []int64{0, 500, 1000, 2000, 3000, 4000, 5000, 7500, 10_000}
BucketHTTPReqs = []int64{0, 150, 300, 450, 600, 900, 1200, 1500, 3000}
BucketHTTPReqs = []int64{
0, 1, 2, 5, 10, 20, 30, 50, 75, 100,
150, 200, 300, 400, 500, 750, 1000,
1500, 2000, 3000, 4000, 5000, 10000,
}
)

// HistogramMeter represents the type of metric that is calculated by aggregating
Expand Down

0 comments on commit 140bf5c

Please sign in to comment.