Skip to content

Commit

Permalink
Fix the Prometheus address references (#1237)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacez320 authored and jessesuen committed Feb 27, 2019
1 parent 94cda3d commit 2b0b8f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions workflow/metrics/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package metrics

import (
"context"
"fmt"
"net/http"

"github.com/prometheus/client_golang/prometheus"
Expand All @@ -20,15 +21,15 @@ type PrometheusConfig struct {
func RunServer(ctx context.Context, config PrometheusConfig, registry *prometheus.Registry) {
mux := http.NewServeMux()
mux.Handle(config.Path, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
srv := &http.Server{Addr: config.Port, Handler: mux}
srv := &http.Server{Addr: fmt.Sprintf(":%s", config.Port), Handler: mux}

defer func() {
if cerr := srv.Close(); cerr != nil {
log.Fatalf("Encountered an '%s' error when tried to close the metrics server running on '%s'", cerr, config.Port)
}
}()

log.Infof("Starting prometheus metrics server at 0.0.0.0%s%s", config.Port, config.Path)
log.Infof("Starting prometheus metrics server at 0.0.0.0:%s%s", config.Port, config.Path)
if err := srv.ListenAndServe(); err != nil {
panic(err)
}
Expand Down

0 comments on commit 2b0b8f1

Please sign in to comment.