added prometheus instrumentation
This commit is contained in:
parent
1636786a27
commit
25b80e29a9
2 changed files with 5 additions and 1 deletions
|
@ -9,6 +9,7 @@ WORKDIR /go/src/$PROJECT
|
|||
# restore dependencies
|
||||
COPY Gopkg.* ./
|
||||
RUN dep ensure --vendor-only -v
|
||||
RUN go get github.com/prometheus/client_golang/prometheus/promhttp
|
||||
COPY . .
|
||||
RUN go install .
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ import (
|
|||
|
||||
"cloud.google.com/go/profiler"
|
||||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
|
||||
// "contrib.go.opencensus.io/exporter/jaeger"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -133,7 +135,8 @@ func main() {
|
|||
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
|
||||
r.HandleFunc("/robots.txt", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, "User-agent: *\nDisallow: /") })
|
||||
r.HandleFunc("/_healthz", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, "ok") })
|
||||
r.HandleFunc("/metrics", promhttp.Handler())
|
||||
r.Path("/metrics").Handler(promhttp.Handler())
|
||||
//r.HandleFunc("/metrics", promhttp.Handler())
|
||||
|
||||
var handler http.Handler = r
|
||||
handler = &logHandler{log: log, next: handler} // add logging
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue