From 49f5c95e09d555887b9d4327b1025d81f54a5b35 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Fri, 12 Feb 2021 12:35:17 -0300 Subject: [PATCH 1/3] PMM-7470 Fixed indexstats params --- main.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 05ac078e8..401877bd7 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,7 @@ package main import ( "fmt" + "log" "strings" "github.com/alecthomas/kong" @@ -72,6 +73,15 @@ func main() { return } + e, err := buildExporter(opts) + if err != nil { + log.Fatal(err) + } + + e.Run() +} + +func buildExporter(opts GlobalFlags) (*exporter.Exporter, error) { log := logrus.New() levels := map[string]logrus.Level{ @@ -95,7 +105,7 @@ func main() { exporterOpts := &exporter.Opts{ CollStatsCollections: strings.Split(opts.CollStatsCollections, ","), CompatibleMode: opts.CompatibleMode, - IndexStatsCollections: strings.Split(opts.CollStatsCollections, ","), + IndexStatsCollections: strings.Split(opts.IndexStatsCollections, ","), Logger: log, Path: opts.WebTelemetryPath, URI: opts.URI, @@ -107,8 +117,8 @@ func main() { e, err := exporter.New(exporterOpts) if err != nil { - log.Fatal(err) + return nil, err } - e.Run() + return e, nil } From e556cf2a510bac2ae347e7f2dc1a20db0495f593 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Tue, 16 Feb 2021 09:20:11 -0300 Subject: [PATCH 2/3] PMM-7470 Updated CI config --- .github/workflows/go.yml | 4 ++-- main_test.go | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 main_test.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4a2ebbd21..6c9d34487 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -57,8 +57,8 @@ jobs: git clone --depth=1 https://go.googlesource.com/go $HOME/gotip cd $HOME/gotip/src ./make.bash - echo "::set-env name=GOROOT::$HOME/gotip" - echo "::add-path::$HOME/gotip/bin" + echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV + echo "$HOME/gotip/bin" >> $GITHUB_PATH - name: Check out code into the Go module directory uses: actions/checkout@v2 diff --git a/main_test.go b/main_test.go new file mode 100644 index 000000000..cfcdf35ee --- /dev/null +++ b/main_test.go @@ -0,0 +1,27 @@ +package main + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestBuildExporter(t *testing.T) { + opts := GlobalFlags{ + CollStatsCollections: "c1,c2,c3", + IndexStatsCollections: "i1,i2,i3", + URI: "mongodb://usr:pwd@127.0.0.1/", + GlobalConnPool: false, // to avoid testing the connection + WebListenAddress: "localhost:12345", + WebTelemetryPath: "/mymetrics", + LogLevel: "debug", + + DisableDiagnosticData: true, + DisableReplicasetStatus: true, + + CompatibleMode: true, + } + + _, err := buildExporter(opts) + assert.NoError(t, err) +} From 90e44aac321df59df6d2c5e9289e39d4dd72391c Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Tue, 16 Feb 2021 09:27:12 -0300 Subject: [PATCH 3/3] Updated CI config --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6c9d34487..33e5df960 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -47,7 +47,7 @@ jobs: steps: - name: Set up Go release if: matrix.go-version != 'tip' - uses: percona-platform/setup-go@v2.1.1 + uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }}