Class DriverMetricsOptions
This class is used to customize options related to Metrics. It is used in WithMetrics(IDriverMetricsProvider, DriverMetricsOptions).
Inheritance
Inherited Members
Namespace: Cassandra.Metrics
Assembly: Cassandra.dll
Syntax
public class DriverMetricsOptions
Constructors
DriverMetricsOptions()
Builds an instance with the default options. Check each method's API docs for information about the default value for each option.
Declaration
public DriverMetricsOptions()
Properties
BucketPrefix
See SetBucketPrefix(string) for more information.
Declaration
public string BucketPrefix { get; }
Property Value
Type | Description |
---|---|
string |
EnabledNodeMetrics
See SetEnabledNodeMetrics(IEnumerable<NodeMetric>) for more information. Defaults to DefaultNodeMetrics.
Declaration
public IEnumerable<NodeMetric> EnabledNodeMetrics { get; }
Property Value
Type | Description |
---|---|
IEnumerable<NodeMetric> |
EnabledSessionMetrics
See SetEnabledSessionMetrics(IEnumerable<SessionMetric>) for more information. Defaults to DefaultSessionMetrics.
Declaration
public IEnumerable<SessionMetric> EnabledSessionMetrics { get; }
Property Value
Type | Description |
---|---|
IEnumerable<SessionMetric> |
Methods
SetBucketPrefix(string)
Prepends a prefix to the bucket name for all metrics. The way the bucket name and metric name parameters are used depends on the IDriverMetricsProvider that is provided to the builder. In the case of the provider based on App.Metrics available in the CassandraCSharpDriver.AppMetrics package, the bucket name will be concatenated with the metric name (separated by a dot), which makes the full metric path like this:
Format: <bucket-prefix>.<bucket-name>.<metric-name>
Here is how the full metric path will look like for Retries in practice with the AppMetrics provider:
// Set metric prefix
var cluster =
Cluster.Builder()
.AddContactPoint("127.0.0.1")
.WithSessionName("session")
.WithMetrics(
metrics.CreateDriverMetricsProvider(),
new DriverMetricsOptions().SetBucketPrefix("web.app"))
.Build();
// Resulting metric name for the NodeMetric.Counters.Retries metric:
web.app.session.nodes.127_0_0_1:9042.retries.total
Declaration
public DriverMetricsOptions SetBucketPrefix(string bucketPrefix)
Parameters
Type | Name | Description |
---|---|---|
string | bucketPrefix |
Returns
Type | Description |
---|---|
DriverMetricsOptions |
SetEnabledNodeMetrics(IEnumerable<NodeMetric>)
Enables specific node metrics. The available node metrics can be found as static readonly properties in the NodeMetric class, e.g., BytesSent. There is also a property that returns a collection with the default node metrics (DefaultNodeMetrics) and one with all node metrics (AllNodeMetrics).
Declaration
public DriverMetricsOptions SetEnabledNodeMetrics(IEnumerable<NodeMetric> enabledNodeMetrics)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<NodeMetric> | enabledNodeMetrics |
Returns
Type | Description |
---|---|
DriverMetricsOptions | This instance. |
SetEnabledSessionMetrics(IEnumerable<SessionMetric>)
Enables specific session metrics. The available session metrics can be found as static readonly properties in the SessionMetric class, e.g., BytesSent. There is also a property that returns a collection with the default session metrics (DefaultSessionMetrics) and one with all session metrics (AllSessionMetrics).
Declaration
public DriverMetricsOptions SetEnabledSessionMetrics(IEnumerable<SessionMetric> enabledSessionMetrics)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SessionMetric> | enabledSessionMetrics |
Returns
Type | Description |
---|---|
DriverMetricsOptions | This instance. |