trallnag / prometheus-fastapi-instrumentator

Instrument your FastAPI with Prometheus metrics.
ISC License
948 stars 84 forks source link

Cannot See Multiprocess metric under /metric page while suing multiple workers #227

Closed liyunrui closed 1 year ago

liyunrui commented 1 year ago

Basically, there are two weird things while loading /metric page

  1. I can see two lines of http_requests_total{handler="/metrics",method="GET",status="2xx"} 33.0. And, it looks like one is not correct. Then, I think this problem related to https://github.com/trallnag/prometheus-fastapi-instrumentator/issues/50

HELP http_requests_total Total number of requests by method, status and handler.

TYPE http_requests_total counter

http_requests_total{handler="/metrics",method="GET",status="2xx"} 33.0

HELP http_request_size_bytes Content length of incoming requests by handler. Only value of header is respected. Otherwise ignored. No percentile calculated.

TYPE http_request_size_bytes summary

http_request_size_bytes_count{handler="/metrics"} 33.0 http_request_size_bytes_sum{handler="/metrics"} 0.0

HELP http_response_size_bytes Content length of outgoing responses by handler. Only value of header is respected. Otherwise ignored. No percentile calculated.

TYPE http_response_size_bytes summary

http_response_size_bytes_count{handler="/metrics"} 33.0 http_response_size_bytes_sum{handler="/metrics"} 235523.0

HELP http_requests_total Total number of requests by method, status and handler.

TYPE http_requests_total counter

http_requests_total{handler="/metrics",method="GET",status="2xx"} 7.0


2. Second strange thing is I already provide **PROMETHEUS_MULTIPROC_DIR=/tmp/prometheus-fastapi-instrumentator/multiproc.** However, I cannot see **Multiprocess metric** under /metric page

It would be appreciated any feedback about is this fixed already or any alternative solutin. 
Appreciated. 

@trallnag 
liyunrui commented 1 year ago
image

I put the screenshot that I already go inside the container to double check if PROMETHEUS_MULTIPROC_DIR is successfully created. Hope this information helps troubleshhot