Closed b2p-fred closed 2 years ago
Some more information that may help...
On a second GET /api/about
I got those
epr_http_2xx_responses_total{action="GET-api_about"} 2
epr_http_2xx_responses_total{action="all"} 2
epr_http_requests_total{action="GET-api_about"} 4
epr_http_requests_total{action="all"} 4
epr_http_responses_total{action="GET-api_about"} 2
epr_http_responses_total{action="all"} 2
A total of 4 ... and then 6 for 3, 8 for 4
And then I tried on another endpoint and I got this:
epr_http_2xx_responses_total{action="GET-api_about"} 4
epr_http_2xx_responses_total{action="GET-api_addresses_get_collection"} 1
epr_http_2xx_responses_total{action="all"} 6
epr_http_requests_total{action="GET-api_about"} 8
epr_http_requests_total{action="GET-api_addresses_get_collection"} 2
epr_http_requests_total{action="all"} 10
epr_http_responses_total{action="GET-api_about"} 4
epr_http_responses_total{action="GET-api_addresses_get_collection"} 1
epr_http_responses_total{action="all"} 6
Still x2 for the http_requests_total
, but note the 4 + 1 = 6 :wink:
That could be a race condition issue, when the first values were read before the total was written. However, if you think, it's a bug, feel free to submit a PR with a fix.
Hmmm. I do not think about a race condition because it is a systematic behaviour. Each unique request
Another example:
GET /api/docs
GET /api/me
redirected to GET /api/users
epr_http_2xx_responses_total{action="GET-api_doc"} 1
epr_http_2xx_responses_total{action="GET-api_users_get_item"} 1
epr_http_2xx_responses_total{action="all"} 2
epr_http_3xx_responses_total{action="GET-api_me"} 1 epr_http_3xx_responses_total{action="all"} 1
epr_http_requests_total{action="GET-api_doc"} 2 epr_http_requests_total{action="GET-api_me"} 2 epr_http_requests_total{action="GET-api_users_get_item"} 2 epr_http_requests_total{action="all"} 6
epr_http_responses_total{action="GET-api_doc"} 1 epr_http_responses_total{action="GET-api_me"} 1 epr_http_responses_total{action="GET-api_users_get_item"} 1 epr_http_responses_total{action="all"} 3
and note that every unique request is counted twice in the requests_total.
All the tests always show this twice count in the total ... I will investigate about this in all my source code
My bad ... and sorry for this issue. I was making those tests on a branch where I tried to add your example for a metrics collector ... and It increments the total count :)
Once again, sorry...
Starting from an empty metrics storage, and after only one request to
GET /api/about
, I got those metrics (removed Prometheus stuff for readability...) :Ok, so the total requests count is 2 whereas I only had one request. Something I missed somewhere ?