Class MetricsPipelineExtensions
- Namespace
- IceRpc
- Assembly
- IceRpc.Metrics.dll
Provides an extension method for Pipeline to add the metrics interceptor.
public static class MetricsPipelineExtensions
- Inheritance
-
MetricsPipelineExtensions
- Inherited Members
Methods
UseMetrics(Pipeline)
Adds a MetricsInterceptor to the pipeline.
public static Pipeline UseMetrics(this Pipeline pipeline)
Parameters
pipelinePipelineThe pipeline being configured.
Returns
- Pipeline
The pipeline being configured.
Examples
The following code adds the metrics interceptor to the invocation pipeline.
// The server uses a test certificate, so we trust its root CA. CreateClientAuthenticationOptions
// is a helper from examples/common/Program.Authentication.cs in the icerpc-csharp repo.
using var rootCA = X509CertificateLoader.LoadCertificateFromFile("certs/cacert.der");
await using var connection = new ClientConnection(
new Uri("icerpc://localhost"),
clientAuthenticationOptions: CreateClientAuthenticationOptions(rootCA));
// Create an invocation pipeline and install the metrics interceptor.
Pipeline pipeline = new Pipeline()
.UseMetrics()
.Into(connection);
- See Also