Class MicrometerObservabilitySettings

java.lang.Object
com.mongodb.observability.ObservabilitySettings
com.mongodb.observability.micrometer.MicrometerObservabilitySettings

@Immutable public final class MicrometerObservabilitySettings extends ObservabilitySettings
The Micrometer Observation settings for tracing operations, commands and transactions.

If tracing is configured by supplying an observationRegistry then setting the environment variable "OBSERVABILITY_MONGODB_ENABLED" is used to enable or disable the creation of tracing spans.

If set the environment variable "OBSERVABILITY_MONGODB_QUERY_TEXT_MAX_LENGTH" will be used to determine the maximum length of command payloads captured in tracing spans. If the environment variable is not set, the entire command payloads are captured (unless a maxQueryTextLength is specified via the Builder).

Since:
5.7
  • Method Details

    • builder

      public static MicrometerObservabilitySettings.Builder builder()
      Convenience method to create a Builder.
      Returns:
      a builder
    • builder

      Convenience method to create a builder from an existing MicrometerObservabilitySettings.
      Parameters:
      settings - create a builder from existing settings
      Returns:
      a builder
    • getObservationRegistry

      @Nullable public io.micrometer.observation.ObservationRegistry getObservationRegistry()
      Returns:
      the observation registry or null
    • isEnableCommandPayloadTracing

      public boolean isEnableCommandPayloadTracing()
      Returns:
      true if command payload tracing is enabled
    • getObservationConvention

      @Nullable public io.micrometer.observation.ObservationConvention<MongodbObservationContext> getObservationConvention()
      Returns:
      the observation convention, or null to use the default
    • getMaxQueryTextLength

      public int getMaxQueryTextLength()
      Returns:
      the maximum length of command payloads captured in tracing spans.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object