Skip to content

Enabling Metrics Server


Enabling Metrics Output in GitFlic

  • Generate an access token:

    cat /dev/urandom | tr -dc 'A-Za-z0-9' | head -c 32  
    
    # Output example:  
    ptY18gMyOOf8b9r91XZmicby5m6RJYqm  
    

  • Add parameters gitflic.actuator.token=<token> and management.endpoints.web.exposure.include=prometheus to the application.properties file:

    # /etc/gitflic/application.properties  
    gitflic.actuator.token=ptY18gMyOOf8b9r91XZmicby5m6RJYqm  
    management.endpoints.web.exposure.include=prometheus  
    
  • Restart GitFlic

Configuring Prometheus Collector

  • Add a new job to Prometheus configuration:

    - job_name: <Job name>  
      metrics_path: /actuator/prometheus  
      static_configs:  
        - targets: ["<GitFlic web server address>"]  
      params:  
        token: ['<Token specified in GitFlic settings>']  
    
    # Example configuration  
    - job_name: gitflic-metrics  
      metrics_path: /actuator/prometheus  
      static_configs:  
        - targets: ["192.168.0.1:8080"]  
          labels:  
            alias: 'gitflic-instance'  
            group: 'gitflic'  
      params:  
        token: ['ptY18gMyOOf8b9r91XZmicby5m6RJYqm']  
    
  • Restart Prometheus

Main Metric Groups

Server Metrics

  • jvm.memory.used — Used memory
  • jvm.memory.max — Maximum available memory
  • jvm.memory.committed — Committed memory
  • jvm.gc.pause — Time spent on garbage collection

Thread Management Metrics

  • jvm.threads.live — Number of live threads
  • jvm.threads.daemon — Number of daemon threads
  • jvm.threads.peak — Peak thread count

System Resource Metrics

  • system.cpu.usage — CPU usage
  • system.load.average — System load average

HTTP Request Metrics

  • http.server.requests — Request statistics including count, response time and status codes

Database Metrics

  • datasource.active — Number of active connections
  • datasource.max — Maximum number of connections

Cache Metrics

  • cache.gets — Number of cache gets
  • cache.puts — Number of cache puts
  • cache.evictions — Number of cache evictions

Automatic Translation!

This page has been translated using automated tools. The text may contain inaccuracies.