1
0
mirror of https://github.com/prometheus/mysqld_exporter.git synced 2025-07-30 06:43:05 +03:00

Switch to go-kit for logs.

Some log messages were made more consistent.

Logging of DSN was removed, as it may contain a password.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
This commit is contained in:
Brian Brazil
2019-09-12 14:15:58 +01:00
parent 8e4e7de3ee
commit 73160d968f
417 changed files with 3634 additions and 232853 deletions

View File

@ -18,21 +18,13 @@ import (
"testing"
"github.com/DATA-DOG/go-sqlmock"
"github.com/go-kit/kit/log"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/log"
"github.com/smartystreets/goconvey/convey"
"gopkg.in/alecthomas/kingpin.v2"
)
func TestScrapeInnodbMetrics(t *testing.T) {
// Suppress a log messages
log.AddFlags(kingpin.CommandLine)
_, err := kingpin.CommandLine.Parse([]string{"--log.level", "fatal"})
if err != nil {
t.Fatal(err)
}
db, mock, err := sqlmock.New()
if err != nil {
t.Fatalf("error opening a stub database connection: %s", err)
@ -54,7 +46,7 @@ func TestScrapeInnodbMetrics(t *testing.T) {
ch := make(chan prometheus.Metric)
go func() {
if err = (ScrapeInnodbMetrics{}).Scrape(context.Background(), db, ch); err != nil {
if err = (ScrapeInnodbMetrics{}).Scrape(context.Background(), db, ch, log.NewNopLogger()); err != nil {
t.Errorf("error calling function on test: %s", err)
}
close(ch)