diff --git a/main.go b/main.go
index 83ef164..742ac91 100644
--- a/main.go
+++ b/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(`
+ _, err := w.Write([]byte(`
Cups Exporter
Cups Exporter
Metrics
`))
+ if err != nil {
+ log.Info("An error occured while writing http response: %v", err)
+ }
})
log.Info("listening on " + opts.Address)
diff --git a/pkg/exporter.go b/pkg/exporter.go
index 47f8283..c7e048c 100644
--- a/pkg/exporter.go
+++ b/pkg/exporter.go
@@ -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)