| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | using IceRpc.Metrics; |
| | 4 | |
|
| | 5 | | namespace IceRpc; |
| | 6 | |
|
| | 7 | | /// <summary>Provides an extension method for <see cref="Router" /> to add the metrics middleware.</summary> |
| | 8 | | public static class MetricsRouterExtensions |
| | 9 | | { |
| | 10 | | /// <summary>Adds a <see cref="MetricsMiddleware" /> to the router.</summary> |
| | 11 | | /// <param name="router">The router being configured.</param> |
| | 12 | | /// <returns>The router being configured.</returns> |
| | 13 | | /// <example> |
| | 14 | | /// The following code adds the metrics middleware to the dispatch pipeline. |
| | 15 | | /// <code source="../../docfx/examples/IceRpc.Metrics.Examples/MetricsMiddlewareExamples.cs" region="UseMetrics" lan |
| | 16 | | /// </example> |
| | 17 | | /// <seealso href="https://github.com/icerpc/icerpc-csharp/tree/main/examples/Metrics"/> |
| | 18 | | public static Router UseMetrics(this Router router) => |
| 0 | 19 | | router.Use(next => new MetricsMiddleware(next)); |
| | 20 | | } |