Skip to content

Commit 837d51e

Browse files
authored
Fix link to metrics path
Signed-off-by: Yoan Blanc <[email protected]>
1 parent 2a584af commit 837d51e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

exporter.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,13 @@ func main() {
383383
registry.MustRegister(collector.NewNginxCollector(ossClient.(*client.NginxClient), "nginx", constLabels.labels))
384384
}
385385
http.Handle(*metricsPath, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
386+
386387
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
387-
_, err := w.Write([]byte(`<html>
388-
<head><title>NGINX Exporter</title></head>
389-
<body>
388+
_, err := fmt.Fprintf(w, `<!DOCTYPE html>
389+
<title>NGINX Exporter</title>
390390
<h1>NGINX Exporter</h1>
391-
<p><a href='/metrics'>Metrics</a></p>
392-
</body>
393-
</html>`))
391+
<p><a href=%q>Metrics</a></p>`,
392+
*metricsPath)
394393
if err != nil {
395394
log.Printf("Error while sending a response for the '/' path: %v", err)
396395
}

0 commit comments

Comments
 (0)