Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rpc server metric label shortened to commitment header #93

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading