Go Prometheus is a package that allows you to integrate Prometheus, a popular open-source monitoring and alerting toolkit, into your golang applications. Prometheus is widely used for monitoring various aspects of software systems, including metrics, time series data, and alerting. This package uses Memory to do the client side aggregation.
Get Go Prometheus package on your project:
go get github.com/tech-djoin/go-prometheus
This packages provides a middleware using Echo which can be added as a global middleware or as a single route.
// in server file or anywhere middleware should be registered
e.Use(goprometheus.MetricCollector())
// in route file or anywhere route should be registered
router.Echo.GET("api/v1/posts", handler, goprometheus.MetricCollector())
To exposes all metrics gathered by collectors, you need a route to access all metrics.
router.Echo.GET("/metrics", echo.WrapHandler(promhttp.Handler()))
This project is licensed under the MIT License - see the LICENSE.md file for details.