Skip to content

Commit

Permalink
fix: rpc server metric label shortened to commitment header
Browse files Browse the repository at this point in the history
  • Loading branch information
samlaf committed Aug 20, 2024
1 parent 943554a commit f71c31c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ func NewServer(host string, port int, router *store.Router, log log.Logger, m me
// WithMetrics is a middleware that records metrics for the route path.
func WithMetrics(handleFn func(http.ResponseWriter, *http.Request) error, m metrics.Metricer) func(http.ResponseWriter, *http.Request) error {
return func(w http.ResponseWriter, r *http.Request) error {
recordDur := m.RecordRPCServerRequest(r.URL.Path)
// we use a commitment schema (https://github.com/Layr-Labs/eigenda-proxy?tab=readme-ov-file#commitment-schemas)
// where the first 3 bytes of the path are the commitment header
// commit type | da layer type | version byte
// we want to group all requests by commitment header, otherwise the prometheus metric labels will explode
commitmentHeader := r.URL.Path[:3]
recordDur := m.RecordRPCServerRequest(commitmentHeader)
defer recordDur()

return handleFn(w, r)
Expand Down

0 comments on commit f71c31c

Please sign in to comment.