linting main.go and exporter.go
This commit is contained in:
parent
5d5c586337
commit
adbca53201
5
main.go
5
main.go
|
@ -37,13 +37,16 @@ func main() {
|
|||
|
||||
http.Handle(opts.MetricsPath, promhttp.Handler())
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(`<html>
|
||||
_, err := w.Write([]byte(`<html>
|
||||
<head><title>Cups Exporter</title></head>
|
||||
<body>
|
||||
<h1>Cups Exporter</h1>
|
||||
<p><a href="` + opts.MetricsPath + `">Metrics</a></p>
|
||||
</body>
|
||||
</html>`))
|
||||
if err != nil {
|
||||
log.Info("An error occured while writing http response: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
log.Info("listening on " + opts.Address)
|
||||
|
|
|
@ -112,7 +112,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
|
|||
cupsUp = 0
|
||||
}
|
||||
|
||||
scrapeDuration := time.Now().Sub(scrapeStartTime)
|
||||
scrapeDuration := time.Since(scrapeStartTime)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(e.scrapeDurationSeconds, prometheus.GaugeValue, scrapeDuration.Seconds())
|
||||
ch <- prometheus.MustNewConstMetric(e.cupsUp, prometheus.GaugeValue, cupsUp)
|
||||
|
|
Loading…
Reference in New Issue