interceptor/

directory
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2021 License: Apache-2.0

README

RK gRpc interceptors

RK style gRpc interceptors which is not bind with any other frameworks.

Table of Contents generated with DocToc

Interceptors

Logging
  • Exchange headers between gRpc client and server.
  • Server(Unary & Stream) and client(Unary & Stream) interceptors.
  • Logs every gRpc requests with RPC metadata and payloads.
  • Get call-scoped zap.Logger instance with requestId and traceId attached.
  • Get call-scoped rkquery.Event instance with RPC metadata.
Metrics
  • Exchange headers between gRpc client and server.
  • Server(Unary & Stream) and client(Unary & Stream) interceptors.
  • Add RequestTime, ErrorCount, ResCodeCount metrics compatible with prometheus.
Tracing
  • Exchange headers between gRpc client and server.
  • Server(Unary & Stream) and client(Unary & Stream) interceptors.
  • Record trace for every gRpc requests with system and RPC metadata as attributes with opentelemetry
  • Option to export data to stdout, files or jaeger.
  • Get call-scoped Tracer, TraceSpan, TracerProvider and TracerPropagator instance.
  • Create call-scoped span with utility function.
Panic
  • Catch panic errors and log stacktrace into logs.
  • Recover from panic and avoid process to be killed by panic.
Meta
  • Send X-- style common headers to client automatically.
Auth
  • Basic Auth
  • Bearer Auth
  • API Key
Development Status: Stable
Appendix

Use bellow command to rebuild proto files, we are using buf to generate proto related files. Configuration could be found at root path of project.

  • make buf

Directories

Path Synopsis
auth
log
meta
metrics
panic
tracing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL