Skip to content

Commit

Permalink
Fix get group id for quota interceptor (#2282)
Browse files Browse the repository at this point in the history
* Fix get group id for quota interceptor

Rename record metrics interceptor to quota b/c we are also checking
quota in that interceptor.

Put the quota interceptor after the auth one.

* remove log
  • Loading branch information
luluz66 authored Jul 15, 2022
1 parent 343b08f commit 908292e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/rpc/filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func logRequestStreamServerInterceptor() grpc.StreamServerInterceptor {
}
}

func recordRequestMetricsUnaryServerInterceptor(env environment.Env) grpc.UnaryServerInterceptor {
func quotaUnaryServerInterceptor(env environment.Env) grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
allow := true
var err error
Expand All @@ -221,7 +221,7 @@ func recordRequestMetricsUnaryServerInterceptor(env environment.Env) grpc.UnaryS
}
}

func recordRequestMetricsStreamServerInterceptor(env environment.Env) grpc.StreamServerInterceptor {
func quotaStreamServerInterceptor(env environment.Env) grpc.StreamServerInterceptor {
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
allow := true
var err error
Expand Down Expand Up @@ -268,10 +268,10 @@ func setHeadersStreamClientInterceptor() grpc.StreamClientInterceptor {
func GetUnaryInterceptor(env environment.Env) grpc.ServerOption {
return grpc.ChainUnaryInterceptor(
requestIDUnaryServerInterceptor(),
recordRequestMetricsUnaryServerInterceptor(env),
logRequestUnaryServerInterceptor(),
requestContextProtoUnaryServerInterceptor(),
authUnaryServerInterceptor(env),
quotaUnaryServerInterceptor(env),
roleAuthUnaryServerInterceptor(env),
copyHeadersUnaryServerInterceptor(),
)
Expand All @@ -280,9 +280,9 @@ func GetUnaryInterceptor(env environment.Env) grpc.ServerOption {
func GetStreamInterceptor(env environment.Env) grpc.ServerOption {
return grpc.ChainStreamInterceptor(
requestIDStreamServerInterceptor(),
recordRequestMetricsStreamServerInterceptor(env),
logRequestStreamServerInterceptor(),
authStreamServerInterceptor(env),
quotaStreamServerInterceptor(env),
roleAuthStreamServerInterceptor(env),
copyHeadersStreamServerInterceptor(),
)
Expand Down

0 comments on commit 908292e

Please sign in to comment.