Class MicrometerObservabilitySettings.Builder

java.lang.Object
com.mongodb.observability.micrometer.MicrometerObservabilitySettings.Builder
Enclosing class:
MicrometerObservabilitySettings

@NotThreadSafe public static final class MicrometerObservabilitySettings.Builder extends Object
A builder for MicrometerObservabilitySettings
  • Method Details

    • applySettings

      Applies the MicrometerObservabilitySettings to the builder

      Note: Overwrites all existing settings

      Parameters:
      settings - the MicrometerObservabilitySettings
      Returns:
      this
    • observationRegistry

      public MicrometerObservabilitySettings.Builder observationRegistry(@Nullable io.micrometer.observation.ObservationRegistry observationRegistry)
      Sets the observation registry to use for creating tracing Spans for operations, commands and transactions.
      Parameters:
      observationRegistry - the observation registry
      Returns:
      this
      Since:
      5.7
    • enableCommandPayloadTracing

      public MicrometerObservabilitySettings.Builder enableCommandPayloadTracing(boolean enableCommandPayload)
      Sets the observation registry to use for creating tracing Spans for operations, commands and transactions.
      Parameters:
      enableCommandPayload - whether command payloads should be captured in tracing spans. This may have performance implications so should be used with care.
      Returns:
      this
      Since:
      5.7
    • maxQueryTextLength

      public MicrometerObservabilitySettings.Builder maxQueryTextLength(int maxQueryTextLength)
      Sets the maximum length of command payloads captured in tracing spans. If not set, the entire command payload is captured.
      Parameters:
      maxQueryTextLength - the maximum length of command payloads captured in tracing spans.
      Returns:
      this
      Since:
      5.7
    • observationConvention

      public MicrometerObservabilitySettings.Builder observationConvention(@Nullable io.micrometer.observation.ObservationConvention<MongodbObservationContext> observationConvention)
      Sets a custom ObservationConvention to control the tag names and values produced by MongoDB observations. If not set, the driver uses DefaultMongodbObservationConvention.
      Parameters:
      observationConvention - the custom convention, or null to use the default
      Returns:
      this
      Since:
      5.7
    • build

      Returns:
      the configured settings