koillection
koillection copied to clipboard
[Feature Request] - Metrics endpoint
Hi,
It would be greate to have some /metrics exposted to be consumed by Prometheus. https://github.com/promphp/prometheus_client_php
Usefull metrics could be :
- Registered user count
- Allowed Disk space Global
- Used Disk space Global
- Allowed disk space per users
- Used disk space per users
- Number of collections, lists, items
As most of your metrics are already in statistics but from an admin point of view.
Hello, sorry for the late answer I'm slowly getting back to add new features to the project.
I'm not familiar with Prometheus/OpenTelemetry, seems quite the rabbit hole :sweat_smile: But I gave it a shot with basic metrics for now :
# HELP user number of registered users
# TYPE user counter
user_total 2
# HELP collection number of created collections
# TYPE collection counter
collection_total 2
collection_total{user="Benjamin"} 1
collection_total{user="Alicia"} 1
# HELP item number of created items
# TYPE item counter
item_total 3
item_total{user="Benjamin"} 3
item_total{user="Alicia"} 0
# HELP datum number of created data
# TYPE datum counter
datum_total 31
datum_total{user="Benjamin"} 30
datum_total{user="Alicia"} 1
# HELP tag number of created tags
# TYPE tag counter
tag_total 0
tag_total{user="Benjamin"} 0
tag_total{user="Alicia"} 0
# HELP tag_category number of created tag categories
# TYPE tag_category counter
tag_category_total 0
tag_category_total{user="Benjamin"} 0
tag_category_total{user="Alicia"} 0
# HELP wishlist number of created wishlists
# TYPE wishlist counter
wishlist_total 0
wishlist_total{user="Benjamin"} 0
wishlist_total{user="Alicia"} 0
# HELP wish number of created wishes
# TYPE wish counter
wish_total 0
wish_total{user="Benjamin"} 0
wish_total{user="Alicia"} 0
# HELP album number of created albums
# TYPE album counter
album_total 0
album_total{user="Benjamin"} 0
album_total{user="Alicia"} 0
# HELP photo number of created photos
# TYPE photo counter
photo_total 0
photo_total{user="Benjamin"} 0
photo_total{user="Alicia"} 0
# HELP template number of created templates
# TYPE template counter
template_total 1
template_total{user="Benjamin"} 1
template_total{user="Alicia"} 0
# HELP scraper number of created scrapers
# TYPE scraper counter
scraper_total 0
scraper_total{user="Benjamin"} 0
scraper_total{user="Alicia"} 0
# HELP used_disk_space_bytes used disk space by uploads (images, videos, files)
# UNIT used_disk_space_bytes bytes
# TYPE used_disk_space_bytes counter
used_disk_space_bytes_total 561152
used_disk_space_bytes_total{user="Benjamin"} 8192
used_disk_space_bytes_total{user="Alicia"} 8192
# HELP available_disk_space_bytes available disk space for uploads (images, videos, files)
# UNIT available_disk_space_bytes bytes
# TYPE available_disk_space_bytes counter
available_disk_space_bytes_total{user="Benjamin"} 536870912
available_disk_space_bytes_total{user="Alicia"} 536870912
Does that seems good/useful to you ?
I'm also considering two points :
- Should I protect the metrics endpoint with some kind of authentication
- Should I prefix all values (like
koillection_collection_totalinstead ofcollection_total), I saw people asking for that on other projects
Sorry on my side for the late reply.
Look realy good to me.
- no need to protect the endpoint metrics. It should be on the op responsibility to control exposed ports
- no need to prefix as per Prometheus administrator, it could be a different application name.