muxprom

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 6 Imported by: 0

README

muxprom

Add prometheus metrics to a Mux server easily.

Usage

package main

import (
	"log"
	"net/http"

	"github.com/gorilla/mux"
	"github.com/AverageMarcus/muxprom"
)

func main() {
	router := mux.NewRouter()
	router.HandleFunc("/healthz", healthz).Methods("GET")

	mp := muxprom.MuxProm{
		MetricName:  "requests", // Default if not provided
		MetricsPath: "/metrics", // Default if not provided
	}
	mp.RegisterPrometheus(router)

	log.Println("Listening on port 8000")
	log.Fatal(http.ListenAndServe(":8000", router))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MuxProm

type MuxProm struct {
	MetricName  string
	MetricsPath string
}

func (*MuxProm) RegisterPrometheus

func (m *MuxProm) RegisterPrometheus(router *mux.Router) error

Jump to

Keyboard shortcuts

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