Extract Individual URL Request Counts

40 views Asked by At

I have a Django app running with NGINX as a reverse proxy. My NGINX configuration looks like this:

server {
        listen 8080 default_server;
        listen [::]:8080 default_server;


    location / {
                proxy_pass http://127.0.0.1:8000;
                proxy_set_header Host $http_host;
                proxy_redirect off;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
        }

    location /metrics {
                stub_status on;
        }
}

I'm using the NGINX Prometheus Exporter to monitor NGINX metrics, and I would like to extract the number of requests for individual URLs. For instance, if I have two URLs, /job1 and /job2, I want to see the following metrics:

number_of_requests{path:/job1} 20;
number_of_requests{path:/job2} 30;

Is there a way to achieve this?

Thanks in advance for your help!

0

There are 0 answers