frontier
frontier copied to clipboard
feat(logger): inject custom zap logger into grpc
making shield relevant changes using https://github.com/odpf/salt/pull/27
This change will make the internal grpc logs messages in the general format as the shield server msgs.
Before:
{"level":"info","msg":"finished unary call with code OK","grpc.start_time":"2022-03-02T12:52:43+05:30","system":"grpc","span.kind":"server","grpc.service":"odpf.shield.v1beta1.ShieldService","grpc.method":"ListRoles","grpc.code":"OK","grpc.time_ms":33.39400100708008}
After:
2022-03-02T12:49:49.474+0530 info finished unary call with code OK {"grpc.start_time": "2022-03-02T12:49:49+05:30", "system": "grpc", "span.kind": "server", "grpc.service": "odpf.shield.v1beta1.ShieldService", "grpc.method": "ListRoles", "grpc.code": "OK", "grpc.time_ms": 24.10300064086914}
Things to consider:
- The internal grpc logging msg (
finished unary call with code OK {...}) is thrown by the intercepter internally that we add to the server. We need to by pass this with a custom one, if we want to change information thrown from grpc logs. - Getting the right Caller file and caller line number(the one from code and not from libraries) seems to be tricky even with SkipCaller. Haven't explored much on this.
@singhvikash11
@bsushmith any updates on this PR ?
This PR is no longer needed. The corresponding changes were added and merged through the #164 - https://github.com/odpf/shield/pull/164/files#diff-d0706a4ae4ecf91c5224ca388f31a087a36af06c40dc81321da7958b25c70b23