Skip to content

Instantly share code, notes, and snippets.

@qbig
Created July 29, 2018 07:50
Show Gist options
  • Save qbig/16f1a10e9cec0acd1c85c6f19ece4ade to your computer and use it in GitHub Desktop.
Save qbig/16f1a10e9cec0acd1c85c6f19ece4ade to your computer and use it in GitHub Desktop.
A Simple Prometheus Server
// A minimal example of how to include Prometheus instrumentation.
package main
import (
"flag"
"log"
"net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
var addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.")
func main() {
flag.Parse()
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(*addr, nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment