Class PrometheusDependencyCheck

java.lang.Object
com.broadleafcommerce.common.extension.PrometheusDependencyCheck
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor

public class PrometheusDependencyCheck extends Object implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
If prometheus is currently deployed with the system (especially in the case of a k8s deployment), this dependency check may be leveraged to determine if a set of dependent services are available. It uses the following properties:
  1. broadleaf.startup.dependency.check.services - comma delimited list of service names to check for up status
  2. broadleaf.startup.dependency.check.prometheus.url - the full url at which prometheus is available
  3. broadleaf.startup.dependency.check.prometheus.label - (Optional). If specified, the label in the prometheus json response that should be matched against the service list. Defaults to "k8s_app"
  4. broadleaf.startup.dependency.check.retry.interval - the number of seconds between each retry attempt. Defaults to 5 seconds.
  5. broadleaf.startup.dependency.check.max.wait - the number of seconds after which the component will no longer wait and allow the application to continue. Default is 300.
If prometheus is not available yet, this component will continue to retry until it becomes available. If one or more services are not marked with an "up" status by Prometheus, this component will continue to retry until the max wait time is surpassed.
  • Constructor Details

    • PrometheusDependencyCheck

      public PrometheusDependencyCheck(org.springframework.core.env.Environment environment)
  • Method Details

    • postProcessBeanDefinitionRegistry

      public void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry beanDefinitionRegistry) throws org.springframework.beans.BeansException
      Specified by:
      postProcessBeanDefinitionRegistry in interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
      Throws:
      org.springframework.beans.BeansException
    • postProcessBeanFactory

      public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory configurableListableBeanFactory) throws org.springframework.beans.BeansException
      Specified by:
      postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
      Throws:
      org.springframework.beans.BeansException