Class PrometheusLifecycleDescriptor

java.lang.Object
de.iip_ecosphere.platform.monitoring.prometheus.PrometheusLifecycleDescriptor
All Implemented Interfaces:
de.iip_ecosphere.platform.support.LifecycleDescriptor

public class PrometheusLifecycleDescriptor extends Object implements de.iip_ecosphere.platform.support.LifecycleDescriptor
Platform lifecycle descriptor for prometheus monitoring. Unpacks and starts prometheus.
Author:
bettelsc
  • Field Details

  • Constructor Details

    • PrometheusLifecycleDescriptor

      public PrometheusLifecycleDescriptor()
  • Method Details

    • getDefaultScrapePoints

      private static List<ConfigModifier.ScrapeEndpoint> getDefaultScrapePoints()
      Returns the default scrape points.
      Returns:
      the default scrape points
    • setDebugFlag

      public static void setDebugFlag(boolean flag)
      Allows changing the debug flag. [testing, debugging]
      Parameters:
      flag - the new value of the debug flag, true with prometheus debug information
    • updateConfiguration

      private void updateConfiguration(ConfigModifier modifier, boolean notify)
      Updates the prometheus configuration. Rules may follow.
      Parameters:
      modifier - the modifier to use
      notify - notify prometheus about the change, e.g., after initial writing
    • getResource

      private static InputStream getResource(String name) throws IOException
      Returns a resource to use.
      Parameters:
      name - the name of the resource
      Returns:
      the resource
      Throws:
      IOException - if the resource can (finally) not be loaded
    • startup

      public void startup(String[] args)
      Specified by:
      startup in interface de.iip_ecosphere.platform.support.LifecycleDescriptor
    • setExporterSupplier

      public void setExporterSupplier(Supplier<IipEcospherePrometheusExporter> supplier)
      Defines the exporter supplier.
      Parameters:
      supplier - the supplier
    • deleteWorkingFiles

      public void deleteWorkingFiles()
      Deletes all files used in prometheus run.
    • getExporter

      public IipEcospherePrometheusExporter getExporter()
      Returns the exporter instance. [testing]
      Returns:
      the exporter instance
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface de.iip_ecosphere.platform.support.LifecycleDescriptor
    • getShutdownHook

      public Thread getShutdownHook()
      Specified by:
      getShutdownHook in interface de.iip_ecosphere.platform.support.LifecycleDescriptor
    • priority

      public int priority()
      Specified by:
      priority in interface de.iip_ecosphere.platform.support.LifecycleDescriptor