jina.serve.runtimes.gateway.request_handling module#
- class jina.serve.runtimes.gateway.request_handling.MonitoringRequestMixin(metrics_registry=None, runtime_name=None)[source]#
Bases:
object
Mixin for the request handling monitoring
- Parameters:
metrics_registry (
Optional
[CollectorRegistry
]) – optional metrics registry for prometheus used if we need to expose metrics from the executor or from the data request handlerruntime_name (
Optional
[str
]) – optional runtime_name that will be registered during monitoring
- class jina.serve.runtimes.gateway.request_handling.RequestHandler(metrics_registry=None, runtime_name=None)[source]#
Bases:
MonitoringRequestMixin
Class that handles the requests arriving to the gateway and the result extracted from the requests future.
- Parameters:
metrics_registry (
Optional
[CollectorRegistry
]) – optional metrics registry for prometheus used if we need to expose metrics from the executor or from the data request handlerruntime_name (
Optional
[str
]) – optional runtime_name that will be registered during monitoring
- handle_request(graph, connection_pool)[source]#
Function that handles the requests arriving to the gateway. This will be passed to the streamer.
- Parameters:
graph (
TopologyGraph
) – The TopologyGraph of the Flow.connection_pool (
GrpcConnectionPool
) – The connection pool to be used to send messages to specific nodes of the graph
- Return type:
Callable
[[Request
],Tuple
[Future
,Optional
[Future
]]]- Returns:
Return a Function that given a Request will return a Future from where to extract the response