-
Notifications
You must be signed in to change notification settings - Fork 2
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
Metric collection is not always accurate #7
Comments
edclement
pushed a commit
that referenced
this issue
Dec 22, 2021
…e and npm publishing Fixes an issue where package download counters were not always incrementing properly (#7). Add an option to collect default prometheus metrics (#4). Remove Babel from the build process and rely only on TypeScript (#2). Rename configuration property `enabled` to `metricsEnabled` to avoid collision with other plugin configurations that are merged into the configuration object passed to the plugin. Enforce commit message formats using commitizen and commitlint. Generate CHANGELOG.md using `standard-version. BREAKING CHANGE: configuration option `enabled` changed to `metricsEnabled`
edclement
pushed a commit
that referenced
this issue
Dec 23, 2021
…y accurate During real world testing, the count of package downloads almost always came in lower then it should have. It seems that sometimes the npm client kills the connection prior to Express thinking the full response has been sent. The solution seems to be to rely on the `close` event instead of the `finish` event on the response object. fix #7
edclement
pushed a commit
that referenced
this issue
Dec 23, 2021
…y accurate During real world testing, the count of package downloads almost always came in lower then it should have. It seems that sometimes the npm client kills the connection prior to Express thinking the full response has been sent. The solution seems to be to rely on the `close` event instead of the `finish` event on the response object. fix #7
edclement
pushed a commit
that referenced
this issue
Dec 23, 2021
…y accurate During real world testing, the count of package downloads almost always came in lower then it should have. It seems that sometimes the npm client kills the connection prior to Express thinking the full response has been sent. The solution seems to be to rely on the `close` event instead of the `finish` event on the response object. fix #7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I started doing real world testing against a Verdaccio instance running in a Docker container that uses this plugin and discovered that the metrics being collected were not 100% accurate. The counts of package downloads were always slightly less then what I was expecting based on the tests I was running.
I ran and debugged a local instance and performed the same tests that were producing inaccurate results. What I discovered is that the Express response
finish
event does not always fire. The plugin currently listens for thefinish
event in order to collect final response data and label metrics appropriately. You can see the line of code for this here.There isn't a lot of documentation available on when the different Node/Express response event types fire. After doing some additional research, I found two good references:
Specifically from the 2nd link above:
This is exactly the type of behavior I was seeing in my testing and debugging. It seems that sometimes the npm client kills the connection prior to Express thinking the full response has been sent. The solution seems to be to rely on the
close
event instead of thefinish
event on the response object.The text was updated successfully, but these errors were encountered: