This repository will showcase on how I implement metrics "safely" by preventing high cardinality for more performant webserver
About prometheus high cardinality, read more in here:
- This way, we can prevent high cardinality by not sending the path values of an route (it will send
/:userId
instead of/isfvDGFs
) - Not found routes and panics metric are not handled, but you can make one easily by using each web framework global error handling
- As I forsee, it requires more acrobatic unit test if you want to make one (my skill issue)
# Prometheus will available at localhost:9090
make startProm
# Grafana will available at localhost:3000
# the default username & password are both `admin`
make startGrafana
# Echo webserver will available at localhost:8080
go run echoExample/main.go
# Fiber webserver will available at localhost:8080
go run fiberExample/main.go