implementation of metrics - #84
Conversation
|
I've added reporting amount of mirrors per repo - if we took the example config it would look like this: I'm considering adding upstream label for downloaded/aborted packages. This would drop my only requirement for reporting amount of mirrors - they needed to be reported to accurately track aborts. Let me know your thoughts on this. |
|
Would it be possible to add a unit test for prometeus functionality like here https://stackoverflow.com/questions/63911468/unit-test-using-golang-prometheus-testutil ? |
|
It most likely would be. I'll take a look. |
change names to be more descriptive expose cache size
|
I added metric tests to the currently written tests. I can decouple them if need be. Cache size currently can only grow in size. The way I see it decreasing it would either require a separate timer to gather the size periodically or an extension of the current purge system but per repo so during the eviction I can subtract the deleted files from the currently reported value. Alternatively just count non-outdated ones as we will visit all of them anyway. PR #74 has some implementation of this. I could maybe integrate it into this patch. This would leave only prefetch to instrument. |
|
The PR looks good to me. Thank you for your work! |
|
I've added the package size and count refresh on purge. It was way easier than I originally thought :) I think this covers at least the basics for metrics. Turns out go is quite fun to learn blindly :) |
anatol
left a comment
There was a problem hiding this comment.
A few minor naming issues, otherwise the change is good for the merge.
add some docs to stat gathering method
|
Awesome, thank you for the PR! |
|
My pleasure :) |
|
Hey @TheFox0x7 I refactored pacoloco download design. The downloader is faster and less error prone now. If you have a chance - could you please check |
|
Looking at it should be matching the original implementation, testing manually on some packages everything worked as it should. One minor unrelated thing I've found: Also thanks, you gave me a perfect excuse to tinker with my gitea instance and add a go CI. |
This PR adds
/metricsendpoint to pacoloco exposing some internal metrics.