Skip to content

Commit

Permalink
Revert "allow listen address specification for prom (stripe#203)"
Browse files Browse the repository at this point in the history
This reverts commit 133d7a9.
  • Loading branch information
matt-intercom authored Jan 4, 2024
1 parent fcf4d89 commit 3ffcaaf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
7 changes: 1 addition & 6 deletions cmd/smokescreen.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ func NewConfiguration(args []string, logger *log.Logger) (*smokescreen.Config, e
Value: "/metrics",
Usage: "Expose prometheus metrics on `ENDPOINT`. Requires --expose-prometheus-metrics to be set. Defaults to \"/metrics\"",
},
cli.StringFlag{
Name: "prometheus-listen-ip",
Value: "0.0.0.0",
Usage: "Listen for prometheus metrics on interface with address IP. Requires --expose-prometheus-metrics to be set. Defaults to \"0.0.0.0\"",
},
cli.StringFlag{
Name: "prometheus-port",
Value: "9810",
Expand Down Expand Up @@ -249,7 +244,7 @@ func NewConfiguration(args []string, logger *log.Logger) (*smokescreen.Config, e
}

if c.IsSet("expose-prometheus-metrics") {
if err := conf.SetupPrometheus(c.String("prometheus-endpoint"), c.String("prometheus-port"), c.String("prometheus-listen-ip")); err != nil {
if err := conf.SetupPrometheus(c.String("prometheus-endpoint"), c.String("prometheus-port")); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/smokescreen/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ func (config *Config) SetupStatsd(addr string) error {
return config.SetupStatsdWithNamespace(addr, DefaultStatsdNamespace)
}

func (config *Config) SetupPrometheus(endpoint string, port string, listenAddr string) error {
metricsClient, err := metrics.NewPrometheusMetricsClient(endpoint, port, listenAddr)
func (config *Config) SetupPrometheus(endpoint string, port string) error {
metricsClient, err := metrics.NewPrometheusMetricsClient(endpoint, port)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/smokescreen/metrics/prometheus_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ type PrometheusMetricsClient struct {
timings map[string]prometheus.HistogramVec
}

func NewPrometheusMetricsClient(endpoint string, port string, listenAddr string) (*PrometheusMetricsClient, error) {
func NewPrometheusMetricsClient(endpoint string, port string) (*PrometheusMetricsClient, error) {
http.Handle(endpoint, promhttp.Handler())
go http.ListenAndServe(fmt.Sprintf("%s:%s", listenAddr, port), nil)
go http.ListenAndServe(fmt.Sprintf(":%s", port), nil)

metricsTags := make(map[string]map[string]string)
for _, m := range metrics {
Expand Down

0 comments on commit 3ffcaaf

Please sign in to comment.