diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2018-12-08 00:40:07 +0300 |
---|---|---|
committer | Andrew Newdigate <andrew@gitlab.com> | 2018-12-08 00:40:07 +0300 |
commit | 7f2dc47c600673d91ba59250a8b4d4a3acd53121 (patch) | |
tree | a0cc04e58afb77fec7826a1ee908109e83be5319 | |
parent | e39784729746cf52469fecbe64b6398814d097ef (diff) |
Fixing linting problems, changing order of interceptorsadd-correlation_id
-rw-r--r-- | internal/middleware/metadatahandler/metadatahandler.go | 4 | ||||
-rw-r--r-- | internal/server/server.go | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/internal/middleware/metadatahandler/metadatahandler.go b/internal/middleware/metadatahandler/metadatahandler.go index 5a8d6ba90..5091e6654 100644 --- a/internal/middleware/metadatahandler/metadatahandler.go +++ b/internal/middleware/metadatahandler/metadatahandler.go @@ -42,7 +42,7 @@ const ClientNameKey = "grpc.meta.client_name" // AuthVersionKey is the key used in ctx_tags to store the auth version const AuthVersionKey = "grpc.meta.auth_version" -const correlationIdKey = "correlation_id" +const correlationIDKey = "correlation_id" // Unknown client and feature. Matches the prometheus grpc unknown value const unknownValue = "unknown" @@ -94,7 +94,7 @@ func addMetadataTags(ctx context.Context) metadataTags { // This is a stop-gap approach to logging correlation_ids correlationID := correlation.ExtractFromContext(ctx) if correlationID != "" { - tags.Set(correlationIdKey, correlationID) + tags.Set(correlationIDKey, correlationID) } return metaTags diff --git a/internal/server/server.go b/internal/server/server.go index a29405c0d..cf5630bad 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -74,6 +74,7 @@ func createNewServer(rubyServer *rubyserver.Server, secure bool) *grpc.Server { opts := []grpc.ServerOption{ grpc.StreamInterceptor(grpc_middleware.ChainStreamServer( grpc_ctxtags.StreamServerInterceptor(ctxTagOpts...), + grpccorrelation.StreamServerCorrelationInterceptor(), // Must be above the metadata handler metadatahandler.StreamInterceptor, grpc_prometheus.StreamServerInterceptor, grpc_logrus.StreamServerInterceptor(logrusEntry), @@ -81,13 +82,13 @@ func createNewServer(rubyServer *rubyserver.Server, secure bool) *grpc.Server { cancelhandler.Stream, // Should be below LogHandler lh.StreamInterceptor(), auth.StreamServerInterceptor(), - grpccorrelation.StreamServerCorrelationInterceptor(), // Panic handler should remain last so that application panics will be // converted to errors and logged panichandler.StreamPanicHandler, )), grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer( grpc_ctxtags.UnaryServerInterceptor(ctxTagOpts...), + grpccorrelation.UnaryServerCorrelationInterceptor(), // Must be above the metadata handler metadatahandler.UnaryInterceptor, grpc_prometheus.UnaryServerInterceptor, grpc_logrus.UnaryServerInterceptor(logrusEntry), @@ -95,7 +96,6 @@ func createNewServer(rubyServer *rubyserver.Server, secure bool) *grpc.Server { cancelhandler.Unary, // Should be below LogHandler lh.UnaryInterceptor(), auth.UnaryServerInterceptor(), - grpccorrelation.UnaryServerCorrelationInterceptor(), // Panic handler should remain last so that application panics will be // converted to errors and logged panichandler.UnaryPanicHandler, |