fasthttprouter_prometheus

package module
v0.0.0-...-a12d40b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2019 License: MIT Imports: 8 Imported by: 1

README

fasthttp-prometheus

Prometheus metrics exporter for go fasthttp/router

Installation

$ go get github.com/Mnwa/fasthttprouter-prometheus

Usage

package main

import (
    "fmt"
    "github.com/fasthttp/router"
    "github.com/valyala/fasthttp"
    "github.com/Mnwa/fasthttprouter-prometheus"
    "log"
)

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

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

    p := fasthttprouter_prometheus.NewPrometheus("fasthttp")
    fastpHandler := p.WrapHandler(r)

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

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

Inspired by

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FasthttpHandlerFunc

type FasthttpHandlerFunc func(*fasthttp.RequestCtx)

type Prometheus

type Prometheus struct {
	MetricsPath string
	// contains filtered or unexported fields
}

func NewPrometheus

func NewPrometheus(subsystem string) *Prometheus

func (*Prometheus) WrapHandler

func (p *Prometheus) WrapHandler(r *router.Router) fasthttp.RequestHandler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL