Skip to content

Commit

Permalink
Merge pull request #23 from shoplineapp/feature/request_log_ignore_he…
Browse files Browse the repository at this point in the history
…alth_check

feat: request log handler ignore health check
  • Loading branch information
EdisonSL committed May 11, 2023
2 parents a61f845 + 2733cc1 commit ce95492
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/grpc/interceptors/request_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,19 @@ func (i RequestLogInterceptor) Handler() grpc.UnaryServerInterceptor {
"whitelist_req_keys": []interface{}{},
})

service := path.Dir(info.FullMethod)[1:]

log := i.logger.WithFields(logrus.Fields{
"trace_id": ctx.Value("trace_id"),
"service": path.Dir(info.FullMethod)[1:],
"service": service,
"method": path.Base(info.FullMethod),
})

// ignore health check request
if service == "grpc.health.v1.Health" {
return handler(ctx, req)
}

ctx = context.WithValue(ctx, "logger", log)

log.Info("Incoming Request")
Expand Down

0 comments on commit ce95492

Please sign in to comment.