buildgrid.server.utils.decorators module
- buildgrid.server.utils.decorators.track_request_id(f: Callable[[_Self, _Req, _Ctx], _Res]) Callable[[_Self, _Req, _Ctx], _Res]
Decorator to set the request ID ContextVar.
This decorator sets the
ctx_grpc_request_id
ContextVar to a UUID for the duration of the decorated function. This ContextVar is used in logging output to allow log lines for the same request to be identified.
- buildgrid.server.utils.decorators.track_request_id_generator(f: Callable[[_Self, _Req, _Ctx], Iterator[_Res]]) Callable[[_Self, _Req, _Ctx], Iterator[_Res]]
Decorator to set the request ID ContextVar.
This is similar to
track_request_id
, except aimed at wrapping generator functions.
- buildgrid.server.utils.decorators.handle_errors_unary_unary(fallback_return_type: ~typing.Type[~google.protobuf.message.Message], get_printable_request: ~typing.Callable[[~typing.Any], ~typing.Any] = <function <lambda>>) Callable[[Func], Func]
- buildgrid.server.utils.decorators.handle_errors_stream_unary(fallback_return_type: ~typing.Type[~google.protobuf.message.Message], get_printable_request: ~typing.Callable[[~typing.Any], ~typing.Any] = <function <lambda>>) Callable[[Func], Func]
- buildgrid.server.utils.decorators.handle_errors_unary_stream(fallback_return_type: Type[Message]) Callable[[Func], Func]