Class TelemetryInterceptor
An interceptor that starts an Activity per request, following OpenTelemetry conventions. The activity context is written in the request TraceContext field and can be restored on the server-side by installing the TelemetryMiddleware.
public class TelemetryInterceptor : IInvoker
- Inheritance
-
TelemetryInterceptor
- Implements
- Inherited Members
- Extension Methods
Remarks
The activities are only created for requests using the icerpc protocol.
Constructors
TelemetryInterceptor(IInvoker, ActivitySource)
Constructs a telemetry interceptor.
public TelemetryInterceptor(IInvoker next, ActivitySource activitySource)
Parameters
next
IInvokerThe next invoker in the invocation pipeline.
activitySource
ActivitySourceThe ActivitySource used to start the request activity.
Methods
InvokeAsync(OutgoingRequest, CancellationToken)
Sends an outgoing request and returns the corresponding incoming response.
public Task<IncomingResponse> InvokeAsync(OutgoingRequest request, CancellationToken cancellationToken)
Parameters
request
OutgoingRequestThe outgoing request being sent.
cancellationToken
CancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<IncomingResponse>
The corresponding IncomingResponse.
Remarks
When request
is a two-way request, the returned task will not complete successfully
until after the request's Payload is fully sent and the response is received from
the peer. When the request is a one-way request, the returned task completes successfully with an empty response
when the request's Payload is fully sent. For all requests (one-way and two-way),
the sending of the request's PayloadContinuation can continue in a background task
after the returned task has completed successfully.