Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Statistics API end point like those displayed on /stats #1080

Open
ForsakenRei opened this issue Sep 27, 2024 · 5 comments
Open

[API] Statistics API end point like those displayed on /stats #1080

ForsakenRei opened this issue Sep 27, 2024 · 5 comments

Comments

@ForsakenRei
Copy link
Contributor

ForsakenRei commented Sep 27, 2024

Suggestion

For a homelab environment where poeple usually has a dashboard, maybe extend the current API end point to add something like total archives, tags etc. display on the https://yourinstance.com/stats? Maybe add them to the /info end point since it already have total_pages_read there.

Additional Context

The dashboard I'm using now is https://github.com/gethomepage/homepage which support custom API so I can display the statics there. I have a Python script to grab the numbers from the /stats page the expose my homemade API but I felt it's not the most elegant way to do it lol.

@Difegue
Copy link
Owner

Difegue commented Sep 29, 2024

I presume you know of api/database/stats for the tag cloud data? This is what the "different tags existing" stat relies on.

For the others, I've added total_archives to /api/info since it was straightforward; Content folder size is a bit more work to API-fy since it currently hard-formats the number to GBs and it's probably be better to return the raw number.

Let me know if this enough for your needs.

@ForsakenRei
Copy link
Contributor Author

Thanks! And yeah I'm aware of the tag cloud data, though I didn't find the total count (or maybe I missed it somewhere?) so as lazy as I am I just use Python to scrap the statistics page lol. I guess if we already have a count for the statistics page it shouldn't be too complicated to add another end point...?

As for the total size, I didn't realized it's hard coded to GB so there is no need to rush, just when you have free time.

@nonamethanks
Copy link
Contributor

nonamethanks commented Oct 18, 2024

The correct way to do this would be to use prometheus metrics, which are the standard for monitoring applications nowadays. That way then it can be pulled into grafana/any other system out there without worrying about supporting different custom apps.

@ForsakenRei
Copy link
Contributor Author

The correct way to do this would be to use prometheus metrics, which are the standard for monitoring applications nowadays. That way then it can be pulled into grafana/any other system out there without worrying about supporting different custom apps.

Yes, my idea is we have some general API end points so people can decide what to do with them, I have prometheus and homepage supports custom API so there is no need for LANraragi to do extra development about dashboard support.

@psilabs-dev
Copy link
Contributor

I'll be playing around with prometheus for a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants