All Projects → chenjiandongx → ginprom

chenjiandongx / ginprom

Licence: MIT license
📡 Prometheus metrics exporter for Gin.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to ginprom

Learning tools
Go 学习、Go 进阶、Go 实用工具类、Go-kit ,Go-Micro 微服务实践、Go 推送
Stars: ✭ 605 (+450%)
Mutual labels:  prometheus, gin
druid-prometheus-exporter
Service to collect Apache Druid metrics and export them to Prometheus
Stars: ✭ 14 (-87.27%)
Mutual labels:  prometheus, gin
Go Http Metrics
Go modular http middleware to measure HTTP requests independent of metrics backend (with Prometheus and OpenCensus as backend implementations) and http framework/library
Stars: ✭ 128 (+16.36%)
Mutual labels:  prometheus, gin
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.通过一个完整的项目示例介绍Go语言项目的最佳实践经验.
Stars: ✭ 344 (+212.73%)
Mutual labels:  prometheus, gin
Go Gin Api
基于 Gin 进行模块化设计的 API 框架,封装了常用功能,使用简单,致力于进行快速的业务研发。比如,支持 cors 跨域、jwt 签名验证、zap 日志收集、panic 异常捕获、trace 链路追踪、prometheus 监控指标、swagger 文档生成、viper 配置文件解析、gorm 数据库组件、gormgen 代码生成工具、graphql 查询语言、errno 统一定义错误码、gRPC 的使用 等等。
Stars: ✭ 730 (+563.64%)
Mutual labels:  prometheus, gin
Microservice learning
从零开始微服务框架使用
Stars: ✭ 31 (-71.82%)
Mutual labels:  prometheus, gin
ginprom
Gin Prometheus metrics exporter inspired by https://github.com/zsais/go-gin-prometheus
Stars: ✭ 97 (-11.82%)
Mutual labels:  prometheus, gin
tilt-pitch
Simple replacement for the Tilt Hydrometer mobile apps and TiltPi with lots of features
Stars: ✭ 32 (-70.91%)
Mutual labels:  prometheus
prometheus-pingdom-exporter
prometheus-pingdom-exporter exports Pingdom metrics to Prometheus
Stars: ✭ 46 (-58.18%)
Mutual labels:  prometheus
dockerX
Examples of amazing Docker/Docker-Compose/Docker Swarm technologies
Stars: ✭ 17 (-84.55%)
Mutual labels:  prometheus
upf-epc
4G/5G Mobile Core User Plane
Stars: ✭ 97 (-11.82%)
Mutual labels:  prometheus
go-12factor-example
Example the 12factor app using golang
Stars: ✭ 20 (-81.82%)
Mutual labels:  gin
Tplan
😃 T计划 是一个集成了任务队列、进程管理、爬虫部署、服务可视化监控、数据展示、在线编码、远程部署的通用系统。
Stars: ✭ 59 (-46.36%)
Mutual labels:  prometheus
Kong-API-Manager
Kong API Manager with Prometheus And Graylog
Stars: ✭ 78 (-29.09%)
Mutual labels:  prometheus
postgres exporter
Postgres exporter
Stars: ✭ 14 (-87.27%)
Mutual labels:  prometheus
pancake
Pancake 是基于 Golang Gin 和 React Semantic UI 构建的个人博客
Stars: ✭ 15 (-86.36%)
Mutual labels:  gin
aioprometheus
A Prometheus Python client library for asyncio-based applications
Stars: ✭ 114 (+3.64%)
Mutual labels:  prometheus
opentsdb exporter
Prometheus exporter for OpenTSDB
Stars: ✭ 20 (-81.82%)
Mutual labels:  prometheus
airflow-prometheus-exporter
Export Airflow metrics (from mysql) in prometheus format
Stars: ✭ 25 (-77.27%)
Mutual labels:  prometheus
KUR8
A visual overview of Kubernetes architecture and Prometheus metrics
Stars: ✭ 197 (+79.09%)
Mutual labels:  prometheus

📡 ginprom

Prometheus metrics exporter for Gin. Inspired by Depado/ginprom.

🔰 Installation

$ go get -u github.com/chenjiandongx/ginprom

📝 Usage

It's easy to get started with ginprom, only a few lines of code needed.

import (
	"github.com/chenjiandongx/ginprom"
	"github.com/gin-gonic/gin"
	"github.com/prometheus/client_golang/prometheus/promhttp"
)

func main() {
 	r := gin.Default()
	// use prometheus metrics exporter middleware.
	//
	// ginprom.PromMiddleware() expects a ginprom.PromOpts{} poniter.
	// It is used for filtering labels by regex. `nil` will pass every requests.
	//
	// ginprom promethues-labels: 
	//   `status`, `endpoint`, `method`
	//
	// for example:
	// 1). I don't want to record the 404 status request. That's easy for it.
	// ginprom.PromMiddleware(&ginprom.PromOpts{ExcludeRegexStatus: "404"})
	//
	// 2). And I wish to ignore endpoints started with `/prefix`.
	// ginprom.PromMiddleware(&ginprom.PromOpts{ExcludeRegexEndpoint: "^/prefix"})
	r.Use(ginprom.PromMiddleware(nil))

 	// register the `/metrics` route.
	r.GET("/metrics", ginprom.PromHandler(promhttp.Handler()))

 	// your working routes
	r.GET("/", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{"message": "home"})
 	})
}

🎉 Metrics

Details about exposed Prometheus metrics.

Name Type Exposed Information
service_uptime Counter HTTP service uptime.
service_http_request_count_total Counter Total number of HTTP requests made.
service_http_request_duration_seconds Histogram HTTP request latencies in seconds.
service_http_request_size_bytes Summary HTTP request sizes in bytes.
service_http_response_size_bytes Summary HTTP response sizes in bytes.

📊 Grafana

Although Promethues offers a simple dashboard, Grafana is clearly a better choice. Grafana configuration.

📃 LICENSE

MIT ©chenjiandongx

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].