Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/6boris/gin_exporter
Exporter for gin metrics
https://github.com/6boris/gin_exporter
gin grafana-dashboard metrics metrics-library prometheus
Last synced: 3 months ago
JSON representation
Exporter for gin metrics
- Host: GitHub
- URL: https://github.com/6boris/gin_exporter
- Owner: 6boris
- License: apache-2.0
- Created: 2019-08-10T02:23:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-17T10:53:08.000Z (over 5 years ago)
- Last Synced: 2024-10-01T15:07:32.438Z (4 months ago)
- Topics: gin, grafana-dashboard, metrics, metrics-library, prometheus
- Language: Go
- Homepage: https://github.com/gin-gonic/gin
- Size: 7.81 KB
- Stars: 48
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The Gin Framework Metrics Middleware
## Preface
Many small companies don't have such a large architecture for micro-services when they do websites. A simple solution for viewing application traffic is very important. This repository is a middleware that integrates seamlessly with Gin.![gin_metrics_v1](https://oss.kyle.link/images/2019/gin_exporter_v1.png)
## How to use
* install the metrics lib
```bash
go get github.com/kylesliu/gin_exporter
```* run the server
```go
package mainimport (
"github.com/gin-gonic/gin"
"github.com/kylesliu/gin_exporter"
)func main() {
app := gin.Default()
gin.SetMode(gin.DebugMode)app.GET("demo1", func(c *gin.Context) {
c.JSON(200, gin.H{
"code": 200,
"msg": "demo1",
})
})gin_exporter.Default(app)
if err := app.Run("127.0.0.1:9000"); err != nil {
panic(err.Error())
}
}
```* Config the Prometheus
```yaml
- job_name: 'gin_metrics'
static_configs:
- targets: ['localhost:9000']
```* Config the Grafana
[Grafana Dashboard](https://snapshot.raintank.io/dashboard/snapshot/YELhgZTaIuynoKd3UPudNJdNBgDy83CC)
## Last
If you have any good suggestions to mention issue or PR, I will check it out in detail.