Class TelemetryPipelineExtensions
- Namespace
- IceRpc
- Assembly
- IceRpc.Telemetry.dll
Provides an extension method for Pipeline to add the telemetry interceptor.
public static class TelemetryPipelineExtensions
- Inheritance
-
TelemetryPipelineExtensions
- Inherited Members
Methods
UseTelemetry(Pipeline, ActivitySource)
Adds the TelemetryInterceptor to the pipeline.
public static Pipeline UseTelemetry(this Pipeline pipeline, ActivitySource activitySource)
Parameters
pipeline
PipelineThe pipeline being configured.
activitySource
ActivitySourceThe ActivitySource used to start the request activity.
Returns
- Pipeline
The pipeline being configured.
Examples
The following code adds the telemetry interceptor to the invocation pipeline.
// The activity source used by the telemetry interceptor.
using var activitySource = new ActivitySource("IceRpc");
// Create a connection.
await using var connection = new ClientConnection(new Uri("icerpc://localhost"));
// Create an invocation pipeline and install the telemetry interceptor.
Pipeline pipeline = new Pipeline()
.UseTelemetry(activitySource)
.Into(connection);
- See Also