Class CosmosClientTelemetryConfig

java.lang.Object
com.azure.cosmos.models.CosmosClientTelemetryConfig

public final class CosmosClientTelemetryConfig extends Object
Class with config options for Cosmos Client telemetry
  • Constructor Details

    • CosmosClientTelemetryConfig

      public CosmosClientTelemetryConfig()
      Instantiates a new Cosmos client telemetry configuration.
  • Method Details

    • sendClientTelemetryToService

      public CosmosClientTelemetryConfig sendClientTelemetryToService(boolean enabled)
      Enables or disables sending Cosmos DB client telemetry to the Azure Cosmos DB Service
      Parameters:
      enabled - a flag indicating whether sending client telemetry to the backend should be enabled or not
      Returns:
      current CosmosClientTelemetryConfig
    • metricsOptions

      public CosmosClientTelemetryConfig metricsOptions(com.azure.core.util.MetricsOptions clientMetricsOptions)
      Sets MetricsOptions to be used to emit client metrics
      Parameters:
      clientMetricsOptions - - the client MetricsOptions - NOTE: for now only CosmosMicrometerMetricsOptions are supported
      Returns:
      current CosmosClientTelemetryConfig
    • clientCorrelationId

      public CosmosClientTelemetryConfig clientCorrelationId(String clientCorrelationId)
      Sets the client correlationId used for tags in metrics. While we strongly encourage usage of singleton instances of CosmosClient there are cases when it is necessary to instantiate multiple CosmosClient instances - for example when an application connects to multiple Cosmos accounts. The client correlationId is used to distinguish client instances in metrics. By default an auto-incrementing number is used but with this method you can define your own correlationId (for example an identifier for the account)
      Parameters:
      clientCorrelationId - the client correlationId to be used to identify this client instance in metrics
      Returns:
      current CosmosClientTelemetryConfig
    • metricTagNames

      @Deprecated public CosmosClientTelemetryConfig metricTagNames(String... tagNames)
      Sets the tags that should be considered for metrics. By default all supported tags are used - and for most use-cases that should be sufficient. But each tag/dimension adds some overhead when collecting the metrics - especially for percentile calculations - so, when it is clear that a certain dimension is not needed, it can be prevented from even considering it when collecting metrics.
      Parameters:
      tagNames - - a comma-separated list of tag names that should be considered
      Returns:
      current CosmosClientTelemetryConfig