Skip to content

Commit

Permalink
Check and return value of w.Write
Browse files Browse the repository at this point in the history
  • Loading branch information
itskingori committed Nov 20, 2024
1 parent f322f18 commit 4a11cf2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion resque_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,18 @@ func main() {

http.Handle(*metricPath, promhttp.HandlerFor(reg, promhttp.HandlerOpts{Registry: reg}))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`<html>
_, err := w.Write([]byte(`<html>
<head><title>Resque Exporter</title></head>
<body>
<h1>Resque Exporter</h1>
<p><a href='` + *metricPath + `'>Metrics</a></p>
</body>
</html>
`))

if err != nil {
log.Error(err)
}
})

log.Infoln("Listening on", *listenAddress)
Expand Down

0 comments on commit 4a11cf2

Please sign in to comment.