{"repo":"zsais/go-gin-prometheus","free":true,"listed":false,"github":"https://github.com/zsais/go-gin-prometheus","clone":"git clone https://github.com/zsais/go-gin-prometheus.git","description":"Gin Web Framework Prometheus metrics exporter","language":"Go","stars":489,"topics":["go","gin-gonic","prometheus","middleware"],"license":"MIT","category":"analytics","readme_excerpt":"go-gin-prometheus Gin Web Framework Prometheus metrics exporter Installation $ go get github.com/zsais/go-gin-prometheus Usage See the example.go file Custom Labels It is possible to add custom labels to all metrics. Disabling Request Body Reading By default, this middleware reads the entire request body to calculate the request size. This can be expensive for large request bodies. You can disable this behavior by setting the DisableBodyReading option to true . When disabled, the middleware will use the ContentLength header to determine the request size. Preserving a low cardinality for the request counter The request counter ( requests total ) has a url label which, although desirable, can become problematic in cases where your application uses templated routes expecting a great number of variations, as Prometheus explicitly recommends against metrics having high cardinality dimensions: https://prometheus.io/docs/practices/naming/#labels If you have for instance a /customer/:name templated route and you don't want to generate a time series for every possible customer name, you could supply this mapping function to the middleware: which would map /customer/alice and /customer/bob to their template /customer/:name , and thus preserve a low cardinality for our metrics. Note for Contributors The default branch of this repository will soon be renamed from master to main . To update your local clone after this change has been made, you can use the following commands:","default_branch":null,"files":null,"tree":[],"storefront":"/r/zsais","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/zsais/go-gin-prometheus/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}