Skip to content

Prometheus metrics exporter for go fasthttp framework

License

Notifications You must be signed in to change notification settings

alpody/fasthttp-prometheus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

fasthttp-prometheus

Prometheus metrics exporter for go fasthttp framework

Installation

$ go get github.com/flf2ko/fasthttp-prometheus

Usage

package main

import (
    "fmt"
    "github.com/buaazp/fasthttprouter"
    "github.com/valyala/fasthttp"
    "log"
    fastp "go-fasthttp-prometheus"
)

func Index(ctx *fasthttp.RequestCtx) {
    fmt.Fprint(ctx, "Welcome!\n")
}

func main() {
    router := fasthttprouter.New()
    APIregist(router)

    p := fastp.NewPrometheus("fasthttp")
    fastpHandler := p.WrapHandler(router)

    log.Fatal(fasthttp.ListenAndServe(":8080", fastpHandler))
}

func APIregist(r *fasthttprouter.Router) {
    r.GET("/", Index)
}

Related Project

Inspired by

About

Prometheus metrics exporter for go fasthttp framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%