modulepackage
0.3.3
Repository: https://github.com/tech-djoin/go-prometheus.git
Documentation: pkg.go.dev
# README
go-prometheus
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.
Installation
Get Go Prometheus package on your project:
go get github.com/tech-djoin/go-prometheus
Usage
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())
Exporting Metrics
To exposes all metrics gathered by collectors, you need a route to access all metrics.
router.Echo.GET("/metrics", echo.WrapHandler(promhttp.Handler()))
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Contributors
# Packages
No description provided by the author
# Functions
RecordHttpRequest records an HTTP request.
RecordLatency records the latency of an HTTP request.
# Structs
Prometheus struct represents a params needed to using all metrics.