Class TestObservationRegistry.TestObservationRegistryBuilder

java.lang.Object
io.micrometer.observation.tck.TestObservationRegistry.TestObservationRegistryBuilder
Enclosing class:
TestObservationRegistry

public static class TestObservationRegistry.TestObservationRegistryBuilder extends Object
Builder to create TestObservationRegistry.
Since:
1.16.0
  • Constructor Details

    • TestObservationRegistryBuilder

      public TestObservationRegistryBuilder()
  • Method Details

    • validateObservationsWithTheSameNameHavingTheSameSetOfLowCardinalityKeys

      public TestObservationRegistry.TestObservationRegistryBuilder validateObservationsWithTheSameNameHavingTheSameSetOfLowCardinalityKeys(boolean flag)
      Enables/disables validating that Observations with the same name should have the same set of low cardinality keys.

      Example 1:

      observation{name=test, lowCardinalityKeyValues=[color=red]}
      observation{name=test, lowCardinalityKeyValues=[color=green]}
      observation{name=test, lowCardinalityKeyValues=[color=blue]}
      

      Example 1 is valid since all the observations with the same name ("test") has the same set of low cardinality keys ("color").

      Example 2:

      observation{name=test, lowCardinalityKeyValues=[color=red]}
      observation{name=test, lowCardinalityKeyValues=[]}
      observation{name=test, lowCardinalityKeyValues=[status=ok]}
      

      Example 2 is invalid since the second observation is missing a key the first one has ("color") and the third observation is not only missing a key the first one has ("color") but it also has an extra key the first one does not have ("status").

    • validateScopesClosedInReverseOrderOfOpening

      public TestObservationRegistry.TestObservationRegistryBuilder validateScopesClosedInReverseOrderOfOpening(boolean flag)
      Enables/disables validating that scopes are closed in the reverse order of opening (LIFO). For example, if scope A is opened and then scope B is opened, scope B must be closed before scope A.
      Parameters:
      flag - whether to enable this validation
      Returns:
      this builder
      Since:
      1.17.0
    • validateScopesOpenedAndClosedOnTheSameThread

      public TestObservationRegistry.TestObservationRegistryBuilder validateScopesOpenedAndClosedOnTheSameThread(boolean flag)
      Enables/disables validating that scopes are opened and closed on the same thread. This can catch situations where a scope is opened on one thread but closed on another, which is typically a programming error.
      Parameters:
      flag - whether to enable this validation
      Returns:
      this builder
      Since:
      1.17.0
    • build

      public TestObservationRegistry build()