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 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

      public CosmosMicrometerMetricsOptions configureDefaultTagNames(CosmosMetricTagName... tags)
      Sets the default tags that should be used for metrics (where applicable) unless overridden for a specific meter in its CosmosMicrometerMeterOptions 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 in CosmosMicrometerMeterOptions for that meter.
      Returns:
      current CosmosMicrometerMetricsOptions instance
    • configureDefaultPercentiles

      public CosmosMicrometerMetricsOptions configureDefaultPercentiles(double... percentiles)
      Sets the default percentiles that should be captured for metrics (where applicable) unless overridden for a specific meter in its CosmosMicrometerMeterOptions 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 in CosmosMicrometerMeterOptions for that meter.
      Returns:
      current CosmosMicrometerMetricsOptions instance
    • enableHistogramsByDefault

      public CosmosMicrometerMetricsOptions 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 its CosmosMicrometerMeterOptions 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 in CosmosMicrometerMeterOptions 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 in CosmosMicrometerMeterOptions.applyDiagnosticThresholds(boolean) for that meter.
      Returns:
      current CosmosMicrometerMetricsOptions instance
    • setEnabled

      public CosmosMicrometerMetricsOptions setEnabled(boolean enabled)
      Overrides:
      setEnabled in class com.azure.core.util.MetricsOptions
    • setMetricCategories

      public CosmosMicrometerMetricsOptions setMetricCategories(CosmosMetricCategory... categories)
      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

      public CosmosMicrometerMetricsOptions addMetricCategories(CosmosMetricCategory... categories)
      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

      public CosmosMicrometerMetricsOptions removeMetricCategories(CosmosMetricCategory... categories)
      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

      Allows overriding meter-specific options.
      Parameters:
      meterName - the meter name
      options - the options to be overridden
      Returns:
      current CosmosMicrometerMetricsOptions instance