BuilderWithMetrics Method (IDriverMetricsProvider, DriverMetricsOptions) |
Enables metrics. DataStax provides an implementation based on a third party library (App.Metrics) on a separate NuGet package: CassandraCSharpDriver.AppMetrics Alternatively, you can implement your own provider that implements IDriverMetricsProvider.
This method enables all individual metrics without a bucket prefix. To customize these settings, use WithMetrics(IDriverMetricsProvider, DriverMetricsOptions). For explanations on these settings, see the API docs of the DriverMetricsOptions class.
The AppMetrics provider also has some settings that can be customized, check out the API docs of Cassandra.AppMetrics.DriverAppMetricsOptions.
Here is an example:
var cluster = Cluster.Builder() .WithMetrics( metrics.CreateDriverMetricsProvider(new DriverAppMetricsOptions()), new DriverMetricsOptions() .SetEnabledNodeMetrics(NodeMetric.DefaultNodeMetrics.Except(new [] { NodeMetric.Meters.BytesSent })) .SetEnabledSessionMetrics( SessionMetric.DefaultSessionMetrics.Except(new[] { SessionMetric.Meters.BytesReceived })) .SetBucketPrefix("web.app")) .Build();
Namespace: Dse
public Builder WithMetrics( IDriverMetricsProvider driverMetricsProvider, DriverMetricsOptions metricsOptions )