Package com.azure.cosmos.models
Class CosmosMicrometerMetricsOptions
java.lang.Object
com.azure.core.util.MetricsOptions
com.azure.cosmos.models.CosmosMicrometerMetricsOptions
public final class CosmosMicrometerMetricsOptions
extends com.azure.core.util.MetricsOptions
Micrometer-specific Azure Cosmos DB SDK metrics options
-
Constructor Summary
ConstructorDescriptionInstantiates new Micrometer-specific Azure Cosmos DB SDK metrics options -
Method Summary
Modifier and TypeMethodDescriptionaddMetricCategories
(CosmosMetricCategory... categories) Adds categories of metrics that should be emitted.applyDiagnosticThresholdsForTransportLevelMeters
(boolean isEnabled) Sets a flag indicating whether for transport level (rntbd) meters should only be emitted when diagnostic thresholds are violated.configureDefaultPercentiles
(double... percentiles) Sets the default percentiles that should be captured for metrics (where applicable) unless overridden for a specific meter in itsCosmosMicrometerMeterOptions
By default percentiles 0.95 and 0.99 are captured.Sets the default tags that should be used for metrics (where applicable) unless overridden for a specific meter in itsCosmosMicrometerMeterOptions
By default all applicable tags are added for each metric.configureMeter
(CosmosMetricName meterName, CosmosMicrometerMeterOptions options) Allows overriding meter-specific options.enableHistogramsByDefault
(boolean publishHistograms) Sets a flag indicating whether by default histograms should be published for metrics (where applicable) unless overridden for a specific meter in itsCosmosMicrometerMeterOptions
By default histograms are published.meterRegistry
(io.micrometer.core.instrument.MeterRegistry clientMetricMeterRegistry) Sets MetricRegistry to be used to emit client metricsremoveMetricCategories
(CosmosMetricCategory... categories) Removes categories of metrics that should be emitted.setEnabled
(boolean enabled) Enables or disables metrics.setMetricCategories
(CosmosMetricCategory... categories) Sets the categories of metrics that should be emitted.Methods inherited from class com.azure.core.util.MetricsOptions
fromConfiguration, getMeterProvider, isEnabled
-
Constructor Details
-
CosmosMicrometerMetricsOptions
public CosmosMicrometerMetricsOptions()Instantiates new Micrometer-specific Azure Cosmos DB SDK metrics options
-
-
Method Details
-
meterRegistry
public CosmosMicrometerMetricsOptions meterRegistry(io.micrometer.core.instrument.MeterRegistry clientMetricMeterRegistry) Sets MetricRegistry to be used to emit client metrics- Parameters:
clientMetricMeterRegistry
- - the MetricRegistry to be used to emit client metrics- Returns:
- current CosmosMicrometerMetricsOptions instance
-
configureDefaultTagNames
Sets the default tags that should be used for metrics (where applicable) unless overridden for a specific meter in itsCosmosMicrometerMeterOptions
By default all applicable tags are added for each metric. Adding tags/dimensions especially with high cardinality has some overhead - so, this method allows modifying the set of tags to be applied when some are not relevant in a certain use case.- Parameters:
tags
- - the default tags to be used (when they are applicable to a specific meter and there is no override inCosmosMicrometerMeterOptions
for that meter.- Returns:
- current CosmosMicrometerMetricsOptions instance
-
configureDefaultPercentiles
Sets the default percentiles that should be captured for metrics (where applicable) unless overridden for a specific meter in itsCosmosMicrometerMeterOptions
By default percentiles 0.95 and 0.99 are captured. If percentiles is null or empty no percentiles will be captured.- Parameters:
percentiles
- - the default percentiles to be captured (when they are applicable to a specific meter and there is no override inCosmosMicrometerMeterOptions
for that meter.- Returns:
- current CosmosMicrometerMetricsOptions instance
-
enableHistogramsByDefault
Sets a flag indicating whether by default histograms should be published for metrics (where applicable) unless overridden for a specific meter in itsCosmosMicrometerMeterOptions
By default histograms are published. Publishing histograms has its overhead - so, this method allows disabling histograms by default.- Parameters:
publishHistograms
- - a flag indicating whether by default histograms should be published for metrics (when they are applicable to a specific meter and there is no override inCosmosMicrometerMeterOptions
for that meter.- Returns:
- current CosmosMicrometerMetricsOptions instance
-
applyDiagnosticThresholdsForTransportLevelMeters
public CosmosMicrometerMetricsOptions applyDiagnosticThresholdsForTransportLevelMeters(boolean isEnabled) Sets a flag indicating whether for transport level (rntbd) meters should only be emitted when diagnostic thresholds are violated. This can be enabled to reduce the cardinality of dimensions (and the number of time series being stored) especially when the partition/replica-level dimensions are enabled and the workload is dealing with containers having a high number of physical partitions. Request-level metrics usually are used to capture metrics per backend endpoint/replica - a high cardinality dimension. Filtering by diagnostic thresholds reduces the overhead - but also means request-level metrics can only be used for debugging purposes - not for monitoring purposes. So, it is important to use the unfiltered operation-level metrics for health monitoring in this case. By default, no filtering happens and diagnostic thresholds are not applied.- Parameters:
isEnabled
- - a flag indicating whether for transport level (rntbd) meters should only be emitted when diagnostic thresholds are violated. (when they are applicable to a specific meter and there is no override inCosmosMicrometerMeterOptions.applyDiagnosticThresholds(boolean)
for that meter.- Returns:
- current CosmosMicrometerMetricsOptions instance
-
setEnabled
Enables or disables metrics. By default, metrics are enabled if and only if metrics implementation is detected.- Overrides:
setEnabled
in classcom.azure.core.util.MetricsOptions
- Parameters:
enabled
- passtrue
to enable metrics.- Returns:
- the updated
MetricsOptions
object.
-
setMetricCategories
Sets the categories of metrics that should be emitted. By default the following categories will be enabled: OperationSummary (required), RequestSummary, DirectChannels, DirectRequests, System (required) (the System and OperationSummary metrics are always collected and can't be disabled when enabling Cosmos metrics) For most use-cases that should be sufficient. An overview of the different metric categories can be found here: https://aka.ms/azure-cosmos-metrics NOTE: metric categories are mutable. You can safely modify the categories on the CosmosClientTelemetryConfig instance passed into the CosmosClientBuilder after the CosmosClient was created - and changes to the config instance will be reflected at runtime by the client.- Parameters:
categories
- - a comma-separated list of metric categories that should be emitted- Returns:
- current CosmosMicrometerMetricsOptions instance
-
addMetricCategories
Adds categories of metrics that should be emitted. By default the following categories will be enabled: OperationSummary (required), RequestSummary, DirectChannels, DirectRequests, System (required) (the System and OperationSummary metrics are always collected and can't be disabled when enabling Cosmos metrics) An overview of the different metric categories can be found here: https://aka.ms/azure-cosmos-metrics NOTE: metric categories are mutable. You can safely modify the categories on the CosmosClientTelemetryConfig instance passed into the CosmosClientBuilder after the CosmosClient was created - and changes to the config instance will be reflected at runtime by the client.- Parameters:
categories
- - a comma-separated list of metric categories that should be emitted- Returns:
- current CosmosMicrometerMetricsOptions instance
-
removeMetricCategories
Removes categories of metrics that should be emitted. By default the following categories will be enabled: OperationSummary (required), RequestSummary, DirectChannels, DirectRequests, System (required) (the System and OperationSummary metrics are always collected and can't be disabled when enabling Cosmos metrics) An overview of the different metric categories can be found here: https://aka.ms/azure-cosmos-metrics NOTE: metric categories are mutable. You can safely modify the categories on the CosmosClientTelemetryConfig instance passed into the CosmosClientBuilder after the CosmosClient was created - and changes to the config instance will be reflected at runtime by the client.- Parameters:
categories
- - a comma-separated list of metric categories that should be emitted- Returns:
- current CosmosMicrometerMetricsOptions instance
-
configureMeter
public CosmosMicrometerMetricsOptions configureMeter(CosmosMetricName meterName, CosmosMicrometerMeterOptions options) Allows overriding meter-specific options.- Parameters:
meterName
- the meter nameoptions
- the options to be overridden- Returns:
- current CosmosMicrometerMetricsOptions instance
-