Open mre opened 4 years ago
Where do you invoke that query? In the cloudflare?
On https://dash.jorgelbg.me. It's not publicly accessible, but I think we can query the Loki endpoint. My idea was to write a cronjob that fetches the information once per week and renders a static JSON with the top N tools which can then be used by Gatsby during the build process. We might have an optional top-badge
, field for each node that points to a pre-rendered image. This way we can also show it on Github if we wanted (e.g. on our static-analysis repo or send a PR to the top tools).
Posting my progress here so that I don't forget.
curl -G -s "http://loki.jorgelbg.me/loki/api/v1/query_range" --data-urlencode 'query=topk(20, sum(count_over_time({domain=~"(analysis-tools\\.dev|www\\.analysis-tools\\.dev)", path=~"/tool/.*"} [6d])) by (path))' --data-urlencode 'step=300' -H 'X-Scope-OrgID: xxxxx' | jq
Now that we get quite a bit of traffic on the website, we could start to provide a badge for the top N tools that we calculate from our webserver monitoring every month.
Posting the query here for future reference: