-
-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing requests in metrics #105
Comments
Is it possible to run app for some time with swagger-stats debug enabled - with env variable As you mentioned HA Proxy - are you by any chance running multiple nodes of app behind HA Proxy used as load balancer ? if so, each node would see subset of all API requests |
We can work to add the debug ENV var to our deployment to gather logs. We do have more than one node behind the HA proxy yes, but metrics are being collected by a single Prometheus and we are looking at a |
After deploying the application with swagger-stats debugging enabled and analyzing logs it appears the issue is that we are using |
Thanks for letting me know! This calls for improvement in matching. Will try to reproduce and handle trailing |
Here is a truncated view of our api definition: /v1/tokens:
post:
operationId: createToken
/v1/sessions:
post:
operationId: createSession We are seeing access to the following in the logs:
The ones with a trailing |
Addressed v0.99.1 |
We recently noticed that swagger-stats appears to be missing some requests in the exposed
swagger-stats/metrics
route. The application in question is usingOpen API
usingexpress-openapi
. We also have metrics for the HA proxies fronting the application as well as abunyan
middleware logging all requests within the same application that happens to also report request-finish events along with a status code.Looking at the latest metrics, we see a little over
1.7M
200s
and100K
401s
being reported by HA proxy, whereas swagger-stats is reporting a little less than700K
200s
and only282
401s
. The logs being written to by the bunyan middleware match what HA proxy is reporting.We are looking specifically at the
api_request_total
metrics.Our package versions are:
We are configuring the swagger-stats middleware as follows:
In case that helps here is how we are configuring the bunyan middleware:
We are using version
12.16.2
of Node.js.The application where swagger-stats is installed has been running for 10 days straight without a restart so we don't believe this is due to stats being reset due to a restart.
The issue is also not that some routes are not in the swagger definition and therefore not being kept track of as we do see some metrics for all routes, just nowhere near as many as we would expect to see.
The
swagger-stats/metrics
route is being scrapped by Prometheus against the application directly as opposed to going through HA Proxy so we also do not believe that is to blame for the discrepancies, nor would that explain the difference in 401s we are seeing.We are at a loss as to why swagger-stats appears to be missing so many requests.
Any help tracking this down would be appreciated.
The text was updated successfully, but these errors were encountered: