| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | using IceRpc.Telemetry; |
| | 4 | | using System.Diagnostics; |
| | 5 | |
|
| | 6 | | namespace IceRpc; |
| | 7 | |
|
| | 8 | | /// <summary>Provides an extension method for <see cref="Pipeline" /> to add the telemetry interceptor. |
| | 9 | | /// </summary> |
| | 10 | | public static class TelemetryPipelineExtensions |
| | 11 | | { |
| | 12 | | /// <summary>Adds the <see cref="TelemetryInterceptor" /> to the pipeline.</summary> |
| | 13 | | /// <param name="pipeline">The pipeline being configured.</param> |
| | 14 | | /// <param name="activitySource">The <see cref="ActivitySource" /> used to start the request activity.</param> |
| | 15 | | /// <returns>The pipeline being configured.</returns> |
| | 16 | | /// <example> |
| | 17 | | /// The following code adds the telemetry interceptor to the invocation pipeline. |
| | 18 | | /// <code source="../../docfx/examples/IceRpc.Telemetry.Examples/TelemetryInterceptorExamples.cs" region="UseTelemet |
| | 19 | | /// </example> |
| | 20 | | /// <seealso href="https://github.com/icerpc/icerpc-csharp/tree/main/examples/Telemetry"/> |
| | 21 | | public static Pipeline UseTelemetry(this Pipeline pipeline, ActivitySource activitySource) => |
| 0 | 22 | | pipeline.Use(next => new TelemetryInterceptor(next, activitySource)); |
| | 23 | | } |