muety / wakapi

📊 A minimalist, self-hosted WakaTime-compatible backend for coding statistics
https://wakapi.dev
MIT License
2.39k stars 147 forks source link

Expose per-user coding stats as Prometheus metrics #484

Closed umlumpa closed 9 months ago

muety commented 1 year ago

If the user, that you're requesting the /metrics endpoint with, is an admin user (is_admin flag on the user object), all metrics, including such prefixed with wakatime_admin_*, should be included.

umlumpa commented 1 year ago

User that i request is admin! in prometheus i am getting wakatimeadmin*

Screenshot 2023-04-29 at 10 31 35

assume that i have small team! and i want to make dashboard in grafana for metrics -- all spent time for each language for all team -- all user that how many time spent and so on how can i do that in wakapi_admin_* just 4 labels

muety commented 1 year ago

Per-user coding stats (languages, editors, etc.) are indeed not exposed through the metrics endpoint. You can always only get the ones for the current user, who is doing the request. So currently, you would have to have a separate Prometheus scrape job for every member of your team, including their respective API keys.

I can add this as a feature request, but with low prio, though. So please don't expect me to get to implementing this any time soon.

muety commented 9 months ago

We won't expose entity-specific data (languages, projects, editors, etc.) as part of Prometheus metrics, because it would blow up cardinality way too much.

Total coding time per user will be included from the next release on.