Skip to content

carousell/fiber-prometheus-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fiber prometheus-middleware

Fiber middleware for Prometheus

Export metrics for request duration request_duration and request count request_count

Example

using fiber

package main

import (
	"github.com/gofiber/fiber/v2"
	"log"

	fiberprom "github.com/carousell/fiber-prometheus-middleware"
)

func main() {

	r := fiber.New()
	p := fiberprom.NewPrometheus("")
	p.Use(r)

	r.Get("/health", func(ctx *fiber.Ctx) error {
		ctx.Status(200)
		log.Println(string(ctx.Request().URI().Path()))
		return ctx.JSON(map[string]string{"status": "pass"})
	})

	log.Println("main is listening on ", "8081")
	log.Fatal(r.Listen(":8081"))

}

About

Prometheus middleware for go fiber

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages