Skip to content

Commit

Permalink
chore(middleware/metrics): if requests and seconds are nil, return di…
Browse files Browse the repository at this point in the history
…rectly (#3298)
  • Loading branch information
Ccheers authored Apr 27, 2024
1 parent 45603e3 commit a803e9d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions middleware/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func Server(opts ...Option) middleware.Middleware {
}
return func(handler middleware.Handler) middleware.Handler {
return func(ctx context.Context, req interface{}) (interface{}, error) {
// if requests and seconds are nil, return directly
if op.requests == nil && op.seconds == nil {
return handler(ctx, req)
}

var (
code int
reason string
Expand Down

0 comments on commit a803e9d

Please sign in to comment.