Skip to content

Commit 04a44cc

Browse files
authored
Merge branch 'main' into add-code-coverage-integration
2 parents 772c02e + a85ea32 commit 04a44cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2375
-1028
lines changed

.github/check-license.go

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
// mongodb_exporter
22
// Copyright (C) 2017 Percona LLC
33
//
4-
// This program is free software: you can redistribute it and/or modify
5-
// it under the terms of the GNU Affero General Public License as published by
6-
// the Free Software Foundation, either version 3 of the License, or
7-
// (at your option) any later version.
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
87
//
9-
// This program is distributed in the hope that it will be useful,
10-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
// GNU Affero General Public License for more details.
8+
// http://www.apache.org/licenses/LICENSE-2.0
139
//
14-
// You should have received a copy of the GNU Affero General Public License
15-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
1615

1716
//go:build ignore
1817
// +build ignore
1918

20-
// check-license checks that AGPL license header in all files matches header in this file.
19+
// check-license checks that Apache 2.0 header in all files matches header in this file.
2120
package main
2221

2322
import (
@@ -36,35 +35,33 @@ var (
3635
copyrightText = `// mongodb_exporter
3736
// Copyright (C) 2022 Percona LLC
3837
//
39-
// This program is free software: you can redistribute it and/or modify
40-
// it under the terms of the GNU Affero General Public License as published by
41-
// the Free Software Foundation, either version 3 of the License, or
42-
// (at your option) any later version.
38+
// Licensed under the Apache License, Version 2.0 (the "License");
39+
// you may not use this file except in compliance with the License.
40+
// You may obtain a copy of the License at
4341
//
44-
// This program is distributed in the hope that it will be useful,
45-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
46-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47-
// GNU Affero General Public License for more details.
42+
// http://www.apache.org/licenses/LICENSE-2.0
4843
//
49-
// You should have received a copy of the GNU Affero General Public License
50-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
44+
// Unless required by applicable law or agreed to in writing, software
45+
// distributed under the License is distributed on an "AS IS" BASIS,
46+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47+
// See the License for the specific language governing permissions and
48+
// limitations under the License.
5149
`
5250

5351
copyrightPattern = regexp.MustCompile(`^// mongodb_exporter
5452
// Copyright \(C\) 20\d{2} Percona LLC
5553
//
56-
// This program is free software: you can redistribute it and/or modify
57-
// it under the terms of the GNU Affero General Public License as published by
58-
// the Free Software Foundation, either version 3 of the License, or
59-
// \(at your option\) any later version.
54+
// Licensed under the Apache License, Version 2\.0 \(the "License"\);
55+
// you may not use this file except in compliance with the License.
56+
// You may obtain a copy of the License at
6057
//
61-
// This program is distributed in the hope that it will be useful,
62-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
63-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64-
// GNU Affero General Public License for more details.
58+
// http://www\.apache\.org/licenses/LICENSE-2\.0
6559
//
66-
// You should have received a copy of the GNU Affero General Public License
67-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
60+
// Unless required by applicable law or agreed to in writing, software
61+
// distributed under the License is distributed on an "AS IS" BASIS,
62+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
63+
// See the License for the specific language governing permissions and
64+
// limitations under the License\.
6865
`)
6966
)
7067

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
- [ ] Update jira ticket description if needed.
1010
- [ ] Attach screenshots/console output to confirm new behavior to jira ticket, if applicable.
1111

12-
Once all checks pass and the code is ready for review, please add `pmm-review-exporters` team as the reviewer. That would assign people from the review team automatically. Report any issues on our [Forum](https://forums.percona.com) or [Discord](https://per.co.na/discord).
12+
Once all checks pass and the code is ready for review, please add `pmm-review-exporters` team as the reviewer. That would assign people from the review team automatically. Report any issues on our [Forum](https://forums.percona.com).

.github/workflows/go.yml

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Go
33
on:
44
schedule:
55
# run every Sunday
6-
- cron: "0 13 * * 0"
6+
- cron: '0 13 * * 0'
77
push:
88
branches:
99
- main
@@ -19,74 +19,29 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
go-version:
23-
- 1.19.x
2422
image:
2523
- mongo:4.2
2624
- mongo:4.4
2725
- mongo:5.0
2826
- percona/percona-server-mongodb:4.2
2927
- percona/percona-server-mongodb:4.4
3028
- percona/percona-server-mongodb:5.0
31-
os: [ubuntu-latest]
32-
may-fail: [false]
3329

34-
include:
35-
# test only one image on tip to detect major Go changes earlier
36-
# without wasting too much time on CI
37-
- go-version: tip
38-
image: mongo:4.4
39-
os: ubuntu-latest
40-
may-fail: true
41-
42-
continue-on-error: ${{ matrix.may-fail }}
43-
runs-on: ${{ matrix.os }}
30+
runs-on: ubuntu-latest
4431

4532
steps:
46-
- name: Set up Go release
47-
if: matrix.go-version != 'tip'
48-
uses: percona-platform/setup-go@v2
49-
with:
50-
go-version: ${{ matrix.go-version }}
51-
52-
- name: Set up Go tip
53-
if: matrix.go-version == 'tip'
54-
run: |
55-
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
56-
cd $HOME/gotip/src
57-
./make.bash
58-
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
59-
echo "$HOME/gotip/bin" >> $GITHUB_PATH
33+
- name: Checkout code
34+
uses: actions/checkout@v4
6035

61-
- name: Check out code into the Go module directory
62-
uses: percona-platform/checkout@v3
63-
64-
- name: Initialize dependencies and linters
65-
run: |
66-
make init
67-
68-
- name: Diff
69-
if: startsWith( ${{ matrix.go-version }}, '1.17')
70-
run: |
71-
make format
72-
git diff --exit-code
73-
74-
- name: Test
75-
run: |
76-
TEST_MONGODB_IMAGE=${{ matrix.image }} make test-cluster
77-
make test-race
78-
make test-cluster-clean
79-
80-
- name: Run checks/linters
81-
run: |
82-
# use GITHUB_TOKEN because only it has access to GitHub Checks API
83-
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
84-
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
85-
make check-license
36+
- name: Set up Go
37+
uses: actions/setup-go@v4
38+
with:
39+
go-version-file: ${{ github.workspace }}/go.mod
8640

87-
- name: Run code coverage
41+
- name: Run tests with code coverage
8842
run: |
8943
TEST_MONGODB_IMAGE=${{ matrix.image }} make test-cluster
44+
sleep 10
9045
make test-cover
9146
make test-cluster-clean
9247

.github/workflows/lint.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Lint
2+
3+
on:
4+
schedule:
5+
# run every Sunday
6+
- cron: '0 13 * * 0'
7+
push:
8+
branches:
9+
- main
10+
- release-0.1x
11+
tags:
12+
- v[0-9]+.[0-9]+.[0-9]+*
13+
pull_request:
14+
15+
jobs:
16+
lint:
17+
name: Lint Check
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v4
27+
with:
28+
go-version-file: ${{ github.workspace }}/go.mod
29+
30+
- name: Initialize dependencies and linters
31+
run: make init
32+
33+
- name: Diff
34+
run: |
35+
make format
36+
git diff --exit-code
37+
- name: Run checks/linters
38+
run: |
39+
# use GITHUB_TOKEN because only it has access to GitHub Checks API
40+
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
41+
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
42+
make check-license

.github/workflows/release.yml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,43 @@ on:
77
- v*
88
# manually trigger the release
99
workflow_dispatch:
10+
1011
jobs:
1112
goreleaser:
1213
runs-on: ubuntu-latest
1314
steps:
14-
-
15-
name: Checkout
16-
uses: percona-platform/checkout@v3
15+
- name: Checkout
16+
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
19-
-
20-
name: Set up Go
21-
uses: percona-platform/setup-go@v2
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
2222
with:
23-
go-version: 1.19
24-
-
25-
name: Login to Docker Hub
26-
uses: percona-platform/login-action@v2
23+
go-version-file: ${{ github.workspace }}/go.mod
24+
25+
- name: Login to Docker Hub
26+
uses: docker/login-action@v2
2727
with:
2828
username: ${{ secrets.DOCKERHUB_USERNAME }}
2929
password: ${{ secrets.DOCKERHUB_TOKEN }}
3030

31-
-
32-
name: Login to GitHub Container Registry
33-
uses: percona-platform/login-action@v2
31+
- name: Login to GitHub Container Registry
32+
uses: docker/login-action@v2
3433
with:
3534
registry: ghcr.io
3635
username: ${{ github.actor }}
3736
password: ${{ secrets.GITHUB_TOKEN }}
3837

39-
-
40-
name: Set up QEMU
41-
uses: docker/setup-qemu-action@v2
38+
- name: Set up QEMU
39+
uses: docker/setup-qemu-action@v3
4240

43-
-
44-
name: Set up Docker Buildx
41+
- name: Set up Docker Buildx
4542
id: buildx
46-
uses: docker/setup-buildx-action@v2
43+
uses: docker/setup-buildx-action@v3
4744

48-
-
49-
name: Run GoReleaser
50-
uses: percona-platform/goreleaser-action@v3
45+
- name: Run GoReleaser
46+
uses: goreleaser/goreleaser-action@v4
5147
with:
5248
version: latest
5349
args: release --rm-dist

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ dist
1010

1111
cover.out
1212
mongodb_exporter
13+
.DS_Store

.golangci-required.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
---
2+
linters-settings:
3+
# prevent import of "errors" instead of "github.com/pkg/errors"
4+
depguard:
5+
rules:
6+
# Name of a rule.
7+
main:
8+
# Packages that are not allowed where the value is a suggestion.
9+
deny:
10+
- pkg: "errors"
11+
desc: Should be replaced by github.com/pkg/errors package
12+
213
# The most valuable linters; they are required to pass for PR to be merged.
314
linters:
415
disable-all: true

.golangci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
linters-settings:
33
# prevent import of "errors" instead of "github.com/pkg/errors"
44
depguard:
5-
list-type: blacklist
6-
include-go-root: true
7-
packages:
8-
- errors
5+
rules:
6+
# Name of a rule.
7+
main:
8+
# Packages that are not allowed where the value is a suggestion.
9+
deny:
10+
- pkg: "errors"
11+
desc: Should be replaced by github.com/pkg/errors package
912

1013
lll:
1114
line-length: 140

CHANGELOG

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
Release 0.39.0
2+
3+
- Fixed issue with connection to authenticated MongoDB Arbiter
4+
- Update dependencies
5+
6+
Release 0.38.0
7+
8+
- Fixed setting auth options for connection to MongoDB
9+
10+
Release 0.37.0
11+
12+
- Disable creating metric mongodb_mongod_storage_engine when it's not possible to retrieve (for example for mongos type of instance)
13+
- Update dependencies
14+
115
Release 0.36.0
216

317
- Added security metrics with info about encryption

0 commit comments

Comments
 (0)