Class NCPrometheusExporter

  • All Implemented Interfaces:
    NCLifecycle

    public class NCPrometheusExporter
    extends Object
    implements NCLifecycle
    Probe lifecycle component that manages OpenCensus Prometheus stats exporter. See https://opencensus.io/exporters/supported-exporters/java/prometheus/ for more details. This is a probe lifecycle component - see NCLifecycle for usage information.

    When running Prometheus you will need to supply it a configuration file. Here's an example of the minimal YAML configuration you can use to monitor both the server and the probe:

     global:
       scrape_interval: 5s
    
       external_labels:
         monitor: 'nlpcraft'
    
     scrape_configs:
       - job_name: 'prometheus'
         scrape_interval: 5s
         static_configs:
           - targets: ['localhost:9090']
       - job_name: 'nlpcraft-server'
         scrape_interval: 5s
         static_configs:
           - targets: ['localhost:8888']
       - job_name: 'nlpcraft-probe'
         scrape_interval: 5s
         static_configs:
           - targets: ['localhost:8889']
     
    See documentation on how to configure probe life cycle components, default values, etc.
    • Constructor Detail

      • NCPrometheusExporter

        public NCPrometheusExporter()
    • Method Detail

      • onInit

        public void onInit()
        Description copied from interface: NCLifecycle
        Called before lifecycle component is used and just after its creation. This method is guaranteed to be called. Default implementation is no-op.
        Specified by:
        onInit in interface NCLifecycle