Repository navigation
feat(analytics): publish visitors by request-count band - #2155
Merged
alanpeixinho merged 2 commits intoOct 7, 2026
Merged
alanpeixinho merged 2 commits into
alanpeixinho merged 2 commits into
Conversation
| "uid": "prometheus" | ||
| }, | ||
| "editorMode": "code", | ||
| "expr": "round(sum(dashboard_visitors_by_request_count_total{client=~\"$client\", band=\"1-5\"}))", |
Member
There was a problem hiding this comment.
This sum is the total since the counter was created, so the time range does nothing. A backend restart also deletes the metric files and the bars go back to zero. Please use increase() over the selected range, same for the other bands.
Contributor
Author
There was a problem hiding this comment.
Changed to use increase now.
Contributor
Author
felipebergamin
approved these changes
Oct 6, 2026
alanpeixinho
force-pushed
the
feat/analytics-visitors-by-request-count
branch
from
October 6, 2026 21:13
2dfe0b8 to
438ba70
Compare
* Store each visitor's /api/ request count for the UTC day, capped at 1000 * Refresh that key's TTL on later hits so the 00:15 job still sees it * Publish one Prometheus sample per visitor into bands from 1-5 through 1000+ * Claim the publish marker before the increment and drop it if the increment fails * Refuse to publish the current UTC day * Add the Visitors by request count Grafana bar gauge and cron command Part of kernelci#2151 Assisted-by: Cursor Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
alanpeixinho
force-pushed
the
feat/analytics-visitors-by-request-count
branch
from
October 7, 2026 17:59
438ba70 to
affd34a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What it is
Publishes one Prometheus sample per visitor for each finished UTC day, bucketed by how many
/api/requests they made (1-5through1000+). The 00:15 UTC job ispublish_visitor_requests. Today is refused so a manual run cannot lock visitors out of that job.Built on top of #2154. Merge that first.
Made with Cursor.
How to test
cd backend && poetry run pytest kernelCI_app/tests/unitTests/middleware/backendRequestMetricsMiddleware_test.py -m unitmonitoring/dashboard.jsonand open Visitors by request count. Bars run1-5,6-10,11-20,21-50,51-100,101-500,501-999,1000+.cd backend && poetry run python manage.py publish_visitor_requests --date YYYY-MM-DDfor a finished UTC day. Omit--datefor yesterday. Today's date exits with an error.HEALTHCHECK_ID_PUBLISH_VISITOR_REQUESTSif the 00:15 job should ping healthcheck.io.Part of #2151
Made with Cursor