darkweak / souin

An HTTP cache system, RFC compliant, compatible with @tyktechnologies, @traefik, @caddyserver, @go-chi, @bnkamalesh, @beego, @devfeel, @labstack, @gofiber, @go-goyave, @go-kratos, @gin-gonic, @roadrunner-server, @zalando, @zeromicro, @nginx and @apache
https://docs.souin.io
MIT License
719 stars 56 forks source link

Prom Metrics not Incrementing #511

Closed 0xEmma closed 3 months ago

0xEmma commented 7 months ago

Caddy File:

   {
      auto_https off
      order cache before rewrite
      cache {
        mode bypass_request
        log_level info
        key {
          disable_host
        }
        api {
          prometheus
        }
        redis {
           url 10.69.42.42:6379
        }
      }
      servers {
        metrics
      }
    }

    localhost:80 {
      root * /srv/
      file_server browse
      log {
        format json
      }
    }
    host.example.com:80 {
      metrics /stream/metrics
      root * /srv/
      file_server {
        browse /etc/caddy/Browse.html
      }
      log {
        format json
      }
      encode zstd gzip
      @match {
        path *.xml
        path *.rpm
        path *.bz2
      }
      cache @match {
        ttl 3600s
      }
    }

Caddy is behind a seperate L7 LB, connected to redis 7.2.4

# HELP souin_cached_response_counter Cached response counter
# TYPE souin_cached_response_counter counter
souin_cached_response_counter 0
# HELP souin_no_cached_response_counter No cached response counter
# TYPE souin_no_cached_response_counter counter
souin_no_cached_response_counter 0
# HELP souin_request_counter Total request counter
# TYPE souin_request_counter counter
souin_request_counter 1
# HELP souin_request_revalidation_counter Total request revalidation counter
# TYPE souin_request_revalidation_counter counter
souin_request_revalidation_counter 0

response time metrics will properly increment, however the cache response metrics will not, only request counter will increment, but not show the proper number of requests as indicated via response time count & logs

darkweak commented 6 months ago

Hello @0xEmma I'm not able to reproduce, all metrics are incrementing (tried on a single instance and everything is working as expected).