-
Notifications
You must be signed in to change notification settings - Fork 46
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
[RSDK-9149] Use RDK Logger Across Interceptors #400
Changes from all commits
8097618
e5dea9c
61533b2
ce5bc5c
1dd945e
beae200
ebdb5bd
d3979fd
e5579f7
919e940
6e396f3
0f383d6
6869b6e
e89b8a0
73fd933
be22266
61b50da
724cbc0
471f3a4
f5b96ae
17fde6b
4cd14e2
9762a28
5b9a1a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,14 +20,11 @@ import ( | |
"github.com/golang-jwt/jwt/v4" | ||
"github.com/google/uuid" | ||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" | ||
grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" | ||
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" | ||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime" | ||
"github.com/improbable-eng/grpc-web/go/grpcweb" | ||
"github.com/pkg/errors" | ||
"go.uber.org/multierr" | ||
"go.uber.org/zap" | ||
"go.uber.org/zap/zapcore" | ||
"golang.org/x/net/http2/h2c" | ||
"google.golang.org/grpc" | ||
"google.golang.org/grpc/codes" | ||
|
@@ -327,10 +324,6 @@ func NewServer(logger utils.ZapCompatibleLogger, opts ...ServerOption) (Server, | |
logger: logger, | ||
} | ||
|
||
grpcLogger := logger.Desugar() | ||
if !(sOpts.debug || utils.Debug) { | ||
grpcLogger = grpcLogger.WithOptions(zap.IncreaseLevel(zap.LevelEnablerFunc(zapcore.ErrorLevel.Enabled))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [qu] is removing this safe? Not sure if we lose out on key functionality here by not setting these options. I'm assuming that these options are replaced by the cases outlined in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the idea here is that if debug mode is not on, we only want to see error level logs and up. We should port that functionality to the interceptor themselves (see if you're seeing info level logs with this set of changes) |
||
} | ||
if sOpts.unknownStreamDesc != nil { | ||
serverOpts = append(serverOpts, grpc.UnknownServiceHandler(sOpts.unknownStreamDesc.Handler)) | ||
} | ||
|
@@ -342,10 +335,10 @@ func NewServer(logger utils.ZapCompatibleLogger, opts ...ServerOption) (Server, | |
logger.Errorw("panicked while calling unary server method", "error", errors.WithStack(err)) | ||
return err | ||
}))), | ||
grpc_zap.UnaryServerInterceptor(grpcLogger), | ||
grpcUnaryServerInterceptor(logger), | ||
unaryServerCodeInterceptor(), | ||
) | ||
unaryInterceptors = append(unaryInterceptors, UnaryServerTracingInterceptor(grpcLogger)) | ||
unaryInterceptors = append(unaryInterceptors, UnaryServerTracingInterceptor()) | ||
unaryAuthIntPos := -1 | ||
if !sOpts.unauthenticated { | ||
unaryInterceptors = append(unaryInterceptors, server.authUnaryInterceptor) | ||
|
@@ -375,10 +368,10 @@ func NewServer(logger utils.ZapCompatibleLogger, opts ...ServerOption) (Server, | |
logger.Errorw("panicked while calling stream server method", "error", errors.WithStack(err)) | ||
return err | ||
}))), | ||
grpc_zap.StreamServerInterceptor(grpcLogger), | ||
grpcStreamServerInterceptor(logger), | ||
streamServerCodeInterceptor(), | ||
) | ||
streamInterceptors = append(streamInterceptors, StreamServerTracingInterceptor(grpcLogger)) | ||
streamInterceptors = append(streamInterceptors, StreamServerTracingInterceptor()) | ||
streamAuthIntPos := -1 | ||
if !sOpts.unauthenticated { | ||
streamInterceptors = append(streamInterceptors, server.authStreamInterceptor) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cheukt Ended up wrapping this to only happen if the level was already below ERROR. Otherwise the linter labels line 140 an "ineffectual assignment."