30.274. Class ExceptionInterceptor

Namespace: ArmoniK.Core.Common.gRPC
Assembly: ArmoniK.Core.Common.dll

Interceptor that maps exceptions thrown by the gRPC services to and records them on the . It is marked Unhealthy (readiness) once the number of errors exceeds the threshold. It also participates in graceful shutdown: it tracks in-flight requests, rejects new ones with while the control plane is shutting down, and signals the to stop the application once all in-flight requests have drained.

public class ExceptionInterceptor : Interceptor, IHealthCheckProvider

30.274.1. Inheritance

objectInterceptorExceptionInterceptor

30.274.2. Implements

IHealthCheckProvider

30.274.3. Inherited Members

Interceptor.BlockingUnaryCall<TRequest, TResponse>(TRequest, ClientInterceptorContext<TRequest, TResponse>, Interceptor.BlockingUnaryCallContinuation<TRequest, TResponse>), Interceptor.AsyncUnaryCall<TRequest, TResponse>(TRequest, ClientInterceptorContext<TRequest, TResponse>, Interceptor.AsyncUnaryCallContinuation<TRequest, TResponse>), Interceptor.AsyncServerStreamingCall<TRequest, TResponse>(TRequest, ClientInterceptorContext<TRequest, TResponse>, Interceptor.AsyncServerStreamingCallContinuation<TRequest, TResponse>), Interceptor.AsyncClientStreamingCall<TRequest, TResponse>(ClientInterceptorContext<TRequest, TResponse>, Interceptor.AsyncClientStreamingCallContinuation<TRequest, TResponse>), Interceptor.AsyncDuplexStreamingCall<TRequest, TResponse>(ClientInterceptorContext<TRequest, TResponse>, Interceptor.AsyncDuplexStreamingCallContinuation<TRequest, TResponse>), Interceptor.UnaryServerHandler<TRequest, TResponse>(TRequest, ServerCallContext, UnaryServerMethod<TRequest, TResponse>), Interceptor.ClientStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest>, ServerCallContext, ClientStreamingServerMethod<TRequest, TResponse>), Interceptor.ServerStreamingServerHandler<TRequest, TResponse>(TRequest, IServerStreamWriter<TResponse>, ServerCallContext, ServerStreamingServerMethod<TRequest, TResponse>), Interceptor.DuplexStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest>, IServerStreamWriter<TResponse>, ServerCallContext, DuplexStreamingServerMethod<TRequest, TResponse>), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

30.274.4. Constructors

30.274.4.1. ExceptionInterceptor(ExceptionManager, ILogger<ExceptionInterceptor>)

Construct the interceptor

public ExceptionInterceptor(ExceptionManager exceptionManager, ILogger<ExceptionInterceptor> logger)

30.274.4.1.1. Parameters

exceptionManager ExceptionManager

Component that record errors and success

logger ILogger<ExceptionInterceptor>

Logger to be used by the interceptor

30.274.5. Methods

30.274.5.1. Check(HealthCheckTag)

Checks the status of a class for the given health check type.

public Task<HealthCheckResult> Check(HealthCheckTag tag)

30.274.5.1.1. Parameters

tag HealthCheckTag

Health check for which the class has to answer.

30.274.5.1.2. Returns

Task<HealthCheckResult>

The result of the check containing the status of the class for the health check type.

30.274.5.2. ClientStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest>, ServerCallContext, ClientStreamingServerMethod<TRequest, TResponse>)

Server-side handler for intercepting client streaming call.

public override Task<TResponse> ClientStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest> requestStream, ServerCallContext context, ClientStreamingServerMethod<TRequest, TResponse> continuation) where TRequest : class where TResponse : class

30.274.5.2.1. Parameters

requestStream IAsyncStreamReader<TRequest>

The request stream of the incoming invocation.

context ServerCallContext

An instance of representing the context of the invocation.

continuation ClientStreamingServerMethod<TRequest, TResponse>

A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and return the response value of the RPC. The interceptor can choose to call it zero or more times at its discretion.

30.274.5.2.2. Returns

Task<TResponse>

A future representing the response value of the RPC. The interceptor can simply return the return value from the continuation intact, or an arbitrary response value as it sees fit. The interceptor has the ability to wrap or substitute the request stream when calling the continuation.

30.274.5.2.3. Type Parameters

TRequest

Request message type for this method.

TResponse

Response message type for this method.

30.274.5.3. DuplexStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest>, IServerStreamWriter<TResponse>, ServerCallContext, DuplexStreamingServerMethod<TRequest, TResponse>)

Server-side handler for intercepting bidirectional streaming calls.

public override Task DuplexStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest> requestStream, IServerStreamWriter<TResponse> responseStream, ServerCallContext context, DuplexStreamingServerMethod<TRequest, TResponse> continuation) where TRequest : class where TResponse : class

30.274.5.3.1. Parameters

requestStream IAsyncStreamReader<TRequest>

The request stream of the incoming invocation.

responseStream IServerStreamWriter<TResponse>

The response stream of the incoming invocation.

context ServerCallContext

An instance of representing the context of the invocation.

continuation DuplexStreamingServerMethod<TRequest, TResponse>

A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and the interceptor can choose to call it zero or more times at its discretion. The interceptor has the ability to wrap or substitute the request and response streams when calling the continuation.

30.274.5.3.2. Returns

Task

30.274.5.3.3. Type Parameters

TRequest

Request message type for this method.

TResponse

Response message type for this method.

30.274.5.4. ServerStreamingServerHandler<TRequest, TResponse>(TRequest, IServerStreamWriter<TResponse>, ServerCallContext, ServerStreamingServerMethod<TRequest, TResponse>)

Server-side handler for intercepting server streaming call.

public override Task ServerStreamingServerHandler<TRequest, TResponse>(TRequest request, IServerStreamWriter<TResponse> responseStream, ServerCallContext context, ServerStreamingServerMethod<TRequest, TResponse> continuation) where TRequest : class where TResponse : class

30.274.5.4.1. Parameters

request TRequest

The request value of the incoming invocation.

responseStream IServerStreamWriter<TResponse>

The response stream of the incoming invocation.

context ServerCallContext

An instance of representing the context of the invocation.

continuation ServerStreamingServerMethod<TRequest, TResponse>

A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and the interceptor can choose to call it zero or more times at its discretion. The interceptor has the ability to wrap or substitute the request value and the response stream when calling the continuation.

30.274.5.4.2. Returns

Task

30.274.5.4.3. Type Parameters

TRequest

Request message type for this method.

TResponse

Response message type for this method.

30.274.5.5. UnaryServerHandler<TRequest, TResponse>(TRequest, ServerCallContext, UnaryServerMethod<TRequest, TResponse>)

Server-side handler for intercepting and incoming unary call.

public override Task<TResponse> UnaryServerHandler<TRequest, TResponse>(TRequest request, ServerCallContext context, UnaryServerMethod<TRequest, TResponse> continuation) where TRequest : class where TResponse : class

30.274.5.5.1. Parameters

request TRequest

The request value of the incoming invocation.

context ServerCallContext

An instance of representing the context of the invocation.

continuation UnaryServerMethod<TRequest, TResponse>

A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and return the response value of the RPC. The interceptor can choose to call it zero or more times at its discretion.

30.274.5.5.2. Returns

Task<TResponse>

A future representing the response value of the RPC. The interceptor can simply return the return value from the continuation intact, or an arbitrary response value as it sees fit.

30.274.5.5.3. Type Parameters

TRequest

Request message type for this method.

TResponse

Response message type for this method.