< Summary

Information
Class: IceRpc.TelemetryRouterExtensions
Assembly: IceRpc.Telemetry
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Telemetry/TelemetryRouterExtensions.cs
Tag: 275_13775359185
Line coverage
0%
Covered lines: 0
Uncovered lines: 1
Coverable lines: 1
Total lines: 22
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
0%
Covered methods: 0
Total methods: 1
Method coverage: 0%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
UseTelemetry(...)100%210%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Telemetry/TelemetryRouterExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Telemetry;
 4using System.Diagnostics;
 5
 6namespace IceRpc;
 7
 8/// <summary>Provides an extension method for <see cref="Router" /> to add the telemetry middleware.</summary>
 9public static class TelemetryRouterExtensions
 10{
 11    /// <summary>Adds a <see cref="TelemetryMiddleware" /> to the router.</summary>
 12    /// <param name="router">The router being configured.</param>
 13    /// <param name="activitySource">The <see cref="ActivitySource" /> is used to start the request activity.</param>
 14    /// <returns>The router being configured.</returns>
 15    /// <example>
 16    /// The following code adds the telemetry middleware to the dispatch pipeline.
 17    /// <code source="../../docfx/examples/IceRpc.Telemetry.Examples/TelemetryMiddlewareExamples.cs" region="UseTelemetr
 18    /// </example>
 19    /// <seealso href="https://github.com/icerpc/icerpc-csharp/tree/main/examples/Telemetry"/>
 20    public static Router UseTelemetry(this Router router, ActivitySource activitySource) =>
 021        router.Use(next => new TelemetryMiddleware(next, activitySource));
 22}