mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #885] Add Total Topics and Total Subscriptions to the /v1/stats API #626
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#626
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kevinlutzer on GitHub (Sep 17, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/885
💡 Idea
I want to expose the total subscriptions and topics on the /v1/stats API. The data will be consumed by some of the analytics tools I use to manage my Kubernetes cluster, as well as I want to display these metrics on my Heimdall Dashboard
Looks like the total topics lives on the server struct. Subscriptions would need to be computed in the API based on the
Topic.Stats()method pointer.💻 Target components
ntfy server
@binwiederhier commented on GitHub (Sep 24, 2023):
My apologies for not responding earlier, but I do not thing that this info should be exposed in a public endpoint due to security concerts. It leaks info. I realize that the number of messages is already questionable, but I need that to display the nice counter on the website.
@kevinlutzer commented on GitHub (Sep 24, 2023):
Thanks for your response!
Ahh okay no worries! Ya I thought that if you were comfortable with the total message quantity and message rate metrics being exposed via API that there wouldn't be an issue with showing the total number of topics, subscriptions etc.
Is there another way it would be possible to expose these metrics? Maybe behind an auth'd API?
@binwiederhier commented on GitHub (Sep 24, 2023):
I could see the stats API returning more stats when queried by an admin user, which should be relatively easy to achieve. Basically return the same stuff that the metrics endpoint would.
@kevinlutzer commented on GitHub (Sep 24, 2023):
Are you referring to this file as the "metrics endpoint" -> https://github.com/binwiederhier/ntfy/blob/main/server/server_metrics.go
@binwiederhier commented on GitHub (Sep 24, 2023):
Yeah, the prometheus endpoint is how you'd usually get metrics. It's pretty awesome.