https://github.com/fourhundredfour/gin_prometheus_pusher
A Gin Middleware that pushes to a Prometheus Instance instead of scraping it. Ideal for Serverless Applications
https://github.com/fourhundredfour/gin_prometheus_pusher
gin gin-framework gin-gonic gin-middleware go golang golang-library prometheus prometheus-client
Last synced: about 1 month ago
JSON representation
A Gin Middleware that pushes to a Prometheus Instance instead of scraping it. Ideal for Serverless Applications
- Host: GitHub
- URL: https://github.com/fourhundredfour/gin_prometheus_pusher
- Owner: fourhundredfour
- License: mit
- Created: 2021-03-07T19:43:50.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-06-11T18:35:16.000Z (over 3 years ago)
- Last Synced: 2024-11-14T14:33:37.566Z (over 1 year ago)
- Topics: gin, gin-framework, gin-gonic, gin-middleware, go, golang, golang-library, prometheus, prometheus-client
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gin_prometheus_pusher
A Gin Middleware that pushes to a Prometheus Instance instead of scraping it.
Ideal for Serverless Applications
## Index
* [Installation](#installation)
* [Example](#example)
## Installation
```
go get github.com/fourhundredfour/gin_prometheus_pusher
```
## Example
```golang
package main
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/fourhundredfour/gin_prometheus_pusher"
)
func main() {
engine := gin.Default()
engine.Use(gin_prometheus_pusher.Prometheus(&gin_prometheus_pusher.PrometheusConfiguration{
Address: "http://example.org/metrics",
Job: "my_job",
}))
engine.GET("/", func(ctx *gin.Context) {
context.JSON(http.StatusOK, nil)
})
http.ListenAndServe(":8080", engine)
}
```