Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/x-punch/gin-prometheus

Gin middleware used to export prometheus metrics
https://github.com/x-punch/gin-prometheus

gin gin-prometheus grafana prometheus

Last synced: 27 days ago
JSON representation

Gin middleware used to export prometheus metrics

Awesome Lists containing this project

README

        

# gin-prometheus
Gin middleware used to export prometheus metrics

# Usage
```go
app := gin.New()
prometheus := prometheus.NewPrometheus("service")
prometheus.Use(app, "/metrics")
```

# Auth Example
```go
package main

import (
"github.com/gin-gonic/gin"
prometheus "github.com/x-punch/gin-prometheus"
)

func main() {
app := gin.New()
app.Use(gin.Logger())
prom := prometheus.NewPrometheus("gin")
prom.UseWithAuth(app, gin.Accounts{"gin": "gonic"}, "/metrics")
if err := app.Run(":80"); err != nil {
panic(err)
}
}
```