Interface TimerRegistry

All Superinterfaces:
io.github.resilience4j.core.Registry<Timer,TimerConfig>
All Known Implementing Classes:
InMemoryTimerRegistry

public interface TimerRegistry extends io.github.resilience4j.core.Registry<Timer,TimerConfig>
Manages all Timer instances.
  • Method Details

    • ofDefaults

      static TimerRegistry ofDefaults(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Creates a TimerRegistry.
      Parameters:
      meterRegistry - the registry to bind Timer to
      Returns:
      a TimerRegistry with a default Timer configuration.
    • of

      static TimerRegistry of(TimerConfig defaultConfig, io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Creates a TimerRegistry.
      Parameters:
      defaultConfig - the default config to use for new Timers
      meterRegistry - the registry to bind Timer to
      Returns:
      a TimerRegistry with a custom Timer configuration.
    • of

      static TimerRegistry of(TimerConfig defaultConfig, Map<String,TimerConfig> configs, io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Creates a TimerRegistry.
      Parameters:
      defaultConfig - the default config to use for new Timers
      configs - the additional configs to use for new Timers
      meterRegistry - the registry to bind Timer to
      Returns:
      a TimerRegistry with a custom Timer configuration.
    • of

      static TimerRegistry of(Map<String,TimerConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<Timer>> registryEventConsumers, Map<String,String> tags, io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Creates a TimerRegistry.
      Parameters:
      configs - the additional configs to use for new Timers
      registryEventConsumers - initialized consumers for timers
      tags - a map of tags for the registry
      meterRegistry - the registry to bind Timer to
      Returns:
      a TimerRegistry with a Map of shared Timer configurations and a list of Timer registry event consumers.
    • of

      static TimerRegistry of(TimerConfig defaultConfig, Map<String,TimerConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<Timer>> registryEventConsumers, Map<String,String> tags, io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Creates a TimerRegistry.
      Parameters:
      defaultConfig - the default config to use for new Timers
      configs - the additional configs to use for new Timers
      registryEventConsumers - initialized consumers for timers
      tags - a map of tags for the registry
      meterRegistry - the registry to bind Timer to
      Returns:
      a TimerRegistry with a Map of shared Timer configurations and a list of Timer registry event consumers.
    • getAllTimers

      Stream<Timer> getAllTimers()
      Returns all managed Timer instances.
      Returns:
      all managed Timer instances.
    • timer

      Timer timer(String name)
      Returns a managed Timer or creates a new one with the default Timer configuration.
      Parameters:
      name - the name of the Timer
      Returns:
      The Timer
    • timer

      Timer timer(String name, Map<String,String> tags)
      Returns a managed Timer or creates a new one with the default Timer configuration.

      The tags passed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.

      Parameters:
      name - the name of the Timer
      tags - tags added to the Timer
      Returns:
      The Timer
    • timer

      Timer timer(String name, TimerConfig config)
      Returns a managed Timer or creates a new one with a custom Timer configuration.
      Parameters:
      name - the name of the Timer
      config - a custom Timer configuration
      Returns:
      The Timer
    • timer

      Timer timer(String name, TimerConfig config, Map<String,String> tags)
      Returns a managed Timer or creates a new one with a custom Timer configuration.

      The tags passed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.

      Parameters:
      name - the name of the Timer
      config - a custom Timer configuration
      tags - tags added to the Timer
      Returns:
      The Timer
    • timer

      Timer timer(String name, Supplier<TimerConfig> configSupplier)
      Returns a managed TimerConfig or creates a new one with a custom TimerConfig configuration.
      Parameters:
      name - the name of the TimerConfig
      configSupplier - a supplier of a custom TimerConfig configuration
      Returns:
      The TimerConfig
    • timer

      Timer timer(String name, Supplier<TimerConfig> configSupplier, Map<String,String> tags)
      Returns a managed Timer or creates a new one with a custom Timer configuration.

      The tags passed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.

      Parameters:
      name - the name of the Timer
      configSupplier - a supplier of a custom Timer configuration
      tags - tags added to the Timer
      Returns:
      The Timer
    • timer

      Timer timer(String name, String configName)
      Returns a managed Timer or creates a new one. The configuration must have been added upfront via Registry.addConfiguration(String, Object).
      Parameters:
      name - the name of the Timer
      configName - the name of the shared configuration
      Returns:
      The Timer
    • timer

      Timer timer(String name, String configName, Map<String,String> tags)
      Returns a managed Timer or creates a new one. The configuration must have been added upfront via Registry.addConfiguration(String, Object).

      The tags passed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.

      Parameters:
      name - the name of the Timer
      configName - the name of the shared configuration
      tags - tags added to the Timer
      Returns:
      The Timer