]> go.fuhry.dev Git - runtime.git/commitdiff
[cmd/prometheus_http_discovery] change listener arg to address-and-port; update labels
authorDan Fuhry <dan@fuhry.com>
Mon, 19 Oct 2026 20:46:44 +0000 (16:46 -0400)
committerDan Fuhry <dan@fuhry.com>
Mon, 19 Oct 2026 21:28:54 +0000 (17:28 -0400)
cmd/prometheus_http_discovery/main.go

index b286dfbfdb93d9fb759ca0b1d5646974b435ca44..c180d77a62653eac33dceb7a3bec9c412458850c 100644 (file)
@@ -29,7 +29,7 @@ func main() {
        serverCtx, cancel := context.WithCancel(context.Background())
        defer cancel()
 
-       port := flag.Uint("port", 9102, "port to listen on")
+       listenAddr := flag.String("listen", "[::1]:9102", "address and port to listen on")
 
        flag.Parse()
 
@@ -81,7 +81,7 @@ func main() {
                                },
                                Labels: map[string]string{
                                        "shard": ep.Shard,
-                                       "host":  ep.Hostname,
+                                       "_host":  ep.Hostname,
                                },
                        })
                }
@@ -97,7 +97,7 @@ func main() {
                w.Write(out)
        })
        server := &http.Server{
-               Addr:      fmt.Sprintf("[::1]:%d", *port),
+               Addr:      *listenAddr,
                TLSConfig: tlsConfig,
                Handler:   loggingMiddleware.HandlerFunc(),
        }