https://github.com/averagemarcus/muxprom
https://github.com/averagemarcus/muxprom
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/averagemarcus/muxprom
- Owner: AverageMarcus
- License: mit
- Created: 2019-10-22T10:10:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-15T03:19:40.000Z (over 3 years ago)
- Last Synced: 2025-02-12T11:24:18.890Z (over 1 year ago)
- Language: Go
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# muxprom
> Add prometheus metrics to a [Mux](https://github.com/gorilla/mux) server easily.
## Usage
```go
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))
}
```