Class MetricsRouterExtensions
- Namespace
- IceRpc
- Assembly
- IceRpc.Metrics.dll
Provides an extension method for Router to add the metrics middleware.
public static class MetricsRouterExtensions
- Inheritance
-
MetricsRouterExtensions
- Inherited Members
Methods
UseMetrics(Router)
Adds a MetricsMiddleware to the router.
public static Router UseMetrics(this Router router)
Parameters
router
RouterThe router being configured.
Returns
- Router
The router being configured.
Examples
The following code adds the metrics middleware to the dispatch pipeline.
// Create a router (dispatch pipeline) and install the metrics middleware.
Router router = new Router()
.UseMetrics()
.Map<IGreeterService>(new Chatbot());
await using var server = new Server(router);
server.Listen();
- See Also