Skip to content

update to use common/log #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions postgres_exporter.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package main

import (
//"bytes"
"database/sql"
"flag"
"fmt"
"math"
"net/http"
"os"
//"regexp"
//"strconv"
//"strings"
"math"
"time"

"strconv"

_ "github.com/lib/pq"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/log"
"strconv"
"github.com/prometheus/common/log"
)

var Version string = "0.0.1"
Expand Down Expand Up @@ -330,7 +327,7 @@ func dbToFloat64(t interface{}) (float64, bool) {
case string:
result, err := strconv.ParseFloat(v, 64)
if err != nil {
log.Println("Could not parse string:", err)
log.Infoln("Could not parse string:", err)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these should be Errorln (or maybe Warnln).

return math.NaN(), false
}
return result, true
Expand Down Expand Up @@ -452,7 +449,7 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {

db, err := sql.Open("postgres", e.dsn)
if err != nil {
log.Println("Error opening connection to database:", err)
log.Infoln("Error opening connection to database:", err)
e.error.Set(1)
return
}
Expand Down Expand Up @@ -498,7 +495,7 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {
// Don't fail on a bad scrape of one metric
rows, err := db.Query(query)
if err != nil {
log.Println("Error running query on database: ", namespace, err)
log.Infoln("Error running query on database: ", namespace, err)
e.error.Set(1)
return
}
Expand All @@ -507,7 +504,7 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {
var columnNames []string
columnNames, err = rows.Columns()
if err != nil {
log.Println("Error retrieving column list for: ", namespace, err)
log.Infoln("Error retrieving column list for: ", namespace, err)
e.error.Set(1)
return
}
Expand All @@ -527,7 +524,7 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {
for rows.Next() {
err = rows.Scan(scanArgs...)
if err != nil {
log.Println("Error retrieving rows:", namespace, err)
log.Infoln("Error retrieving rows:", namespace, err)
e.error.Set(1)
return
}
Expand Down
5 changes: 5 additions & 0 deletions vendor/github.com/prometheus/common/NOTICE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading