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
  • Loading branch information
Ccheers committed Apr 21, 2024
1 parent 78b67ad commit 74c33d9
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 74c33d9

Please sign in to comment.