Skip to content

Commit f1ad6c3

Browse files
authored
Merge branch 'main' into PMM-7-use-image-from-env-for-encrypted
2 parents 08ee76b + 6ed58cd commit f1ad6c3

Some content is hidden

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

58 files changed

+2760
-1543
lines changed

.github/workflows/go.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ jobs:
2222
image:
2323
- mongo:4.4
2424
- mongo:5.0
25+
- mongo:6.0
26+
- mongo:7.0
27+
- mongo:8.0
28+
- mongo:latest
2529
- percona/percona-server-mongodb:4.4
2630
- percona/percona-server-mongodb:5.0
31+
- percona/percona-server-mongodb:6.0
32+
- percona/percona-server-mongodb:7.0
33+
- percona/percona-server-mongodb:latest
2734

2835
runs-on: ubuntu-latest
2936

@@ -42,3 +49,17 @@ jobs:
4249
sleep 10
4350
make test-race
4451
make test-cluster-clean
52+
53+
- name: Run debug commands on failure
54+
if: ${{ failure() }}
55+
run: |
56+
echo "--- Environment variables ---"
57+
env | sort
58+
echo "--- GO Environment ---"
59+
go env | sort
60+
echo "--- Git status ---"
61+
git status
62+
echo "--- Docker logs ---"
63+
docker compose logs
64+
echo "--- Docker ps ---"
65+
docker compose ps -a

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
uses: docker/setup-buildx-action@v3
4444

4545
- name: Run GoReleaser
46-
uses: goreleaser/goreleaser-action@v5
46+
uses: goreleaser/goreleaser-action@v6
4747
with:
48-
version: v1.18.2
49-
args: release --rm-dist
48+
version: "~> v2"
49+
args: release --clean
5050
env:
5151
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
dist: build
2+
version: 2
23
builds:
34
- binary: mongodb_exporter
45
env:
56
- CGO_ENABLED=0
67
goos:
78
- linux
89
- darwin
10+
- windows
911
goarch:
1012
- amd64
1113
- arm
@@ -23,9 +25,9 @@ archives:
2325
- name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Os }}-{{ .Arch }}"
2426
wrap_in_directory: true
2527
snapshot:
26-
name_template: "{{ .ShortCommit }}"
28+
version_template: "{{ .ShortCommit }}"
2729
changelog:
28-
skip: true
30+
use: github
2931
release:
3032
github:
3133
owner: percona
@@ -77,8 +79,9 @@ docker_manifests:
7779
image_templates:
7880
- ghcr.io/percona/mongodb_exporter:{{.Version}}-arm64v8
7981
- ghcr.io/percona/mongodb_exporter:{{.Version}}-amd64
82+
8083
nfpms:
81-
- file_name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Os }}-{{ .Arch }}"
84+
- file_name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Os }}-{{- if eq .Arch `amd64` }}64-bit{{- else }}{{ .Arch }}{{ end }}"
8285
homepage: https://www.percona.com/
8386
description: MongoDB exporter for Prometheus
8487
maintainer: Percona
@@ -88,8 +91,6 @@ nfpms:
8891
- deb
8992
- rpm
9093
bindir: /usr/bin
91-
replacements:
92-
amd64: 64-bit
9394
scripts:
9495
postinstall: ".scripts/postinst"
9596
contents:

CHANGELOG

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
Release 0.41.1
2+
- Fix panic (regression bug in v0.41.0) occuring when fcv collector is enabled
3+
4+
Release 0.41.0
5+
6+
- Add extra label for replicaset metrics
7+
- Add information about supported MongoDB versions
8+
- Add command line flag to disable metrics about the exporter it-self
9+
- Add PBM metrics collector
10+
- Add cluster role label for mongodb_up
11+
- Add feature compatibility version collector
12+
- Migrate chunks metrics from v1 compatibility to shards collector
13+
- Correctly recognize arbiter nodes
14+
- Fix node type detection
15+
- Collstats, indexstats iterate only over collections, not views.
16+
- Fix case where users are prefixed with mongodb
17+
- Reconsider inclusion of opid in mongodb_currentop_query_uptime
18+
- List only authorized collections
19+
- Correctly evaluate balancer metrics
20+
- Reduce error logs from diagnostic data on arbiter nodes
21+
- Refactoring currentop_collector
22+
- Remove system colections from index stats
23+
- Update Go version
24+
- Update dependencies
25+
126
Release 0.40.0
227

328
- Multi-target support

CONTRIBUTING.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,24 @@ It will install `goimports`, `goreleaser`, `golangci-lint` and `reviewdog`.
9191

9292
The testing sandbox starts `n` MongoDB instances as follows:
9393

94-
- 3 Instances for shard 1 at ports 17001, 17002, 17003
95-
- 3 instances for shard 2 at ports 17004, 17005, 17006
94+
- 3 Instances for shard 1 at ports 17001, 17002, 17003 (with no authentication)
95+
- 3 instances for shard 2 at ports 17004, 17005, 17006 (with authentication enabled)
9696
- 3 config servers at ports 17007, 17008, 17009
9797
- 1 mongos server at port 17000
9898
- 1 stand alone instance at port 27017
9999

100-
All instances are currently running without user and password so for example, to connect to the **mongos** you can just use:
100+
To connect to the **mongos** on shard 1, you can use:
101101

102102
```
103103
mongo mongodb://127.0.0.1:17001/admin
104104
```
105105

106+
To connect to the **mongos** on shard 2 (with authentication enabled), you can use:
107+
108+
```
109+
mongo mongodb://admin:[email protected]:17001/admin
110+
```
111+
106112
The sandbox can be started using the provided Makefile using: `make test-cluster` and it can be stopped using `make test-cluster-clean`.
107113

108114
### Running tests

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ REPO ?= percona/$(NAME)
1717
GORELEASER_FLAGS ?=
1818
UID ?= $(shell id -u)
1919

20-
export TEST_MONGODB_IMAGE?=mongo:4.2
20+
export TEST_MONGODB_IMAGE?=mongo:4.4
2121
export TEST_MONGODB_ADMIN_USERNAME?=
2222
export TEST_MONGODB_ADMIN_PASSWORD?=
2323
export TEST_MONGODB_USERNAME?=
@@ -76,8 +76,9 @@ build: ## Compile using plain go build
7676
release: ## Build the binaries using goreleaser
7777
docker run --rm --privileged \
7878
-v ${PWD}:/go/src/github.com/user/repo \
79+
-v /var/run/docker.sock:/var/run/docker.sock \
7980
-w /go/src/github.com/user/repo \
80-
goreleaser/goreleaser release --snapshot --skip-publish --rm-dist
81+
goreleaser/goreleaser release --snapshot --skip=publish --clean
8182

8283
FILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
8384

@@ -104,7 +105,9 @@ test-race: env ## Run all tests with race flag.
104105
go test -race -v -timeout 30s ./...
105106

106107
test-cluster: env ## Starts MongoDB test cluster. Use env var TEST_MONGODB_IMAGE to set flavor and version. Example: TEST_MONGODB_IMAGE=mongo:3.6 make test-cluster
107-
docker compose up -d
108+
docker compose up --build -d
109+
./docker/scripts/setup-pbm.sh
108110

109111
test-cluster-clean: env ## Stops MongoDB test cluster.
110112
docker compose down --remove-orphans
113+

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Currently, these metric sources are implemented:
1616
- replSetGetStatus
1717
- serverStatus
1818

19+
## Supported MongoDB versions
20+
21+
The exporter works with Percona Server for MongoDB and MongoDB Community or Enterprise Edition versions 4.4 and newer. Older versions might also work but are not tested anymore.
22+
1923
## Info on Percona MongoDB exporter versions
2024

2125
The old 0.1x.y version (ex `master` branch) has been moved to the `release-0.1x` branch.
@@ -48,10 +52,10 @@ A docker image is available on the [official percona repository](https://hub.doc
4852

4953
```sh
5054
# with podman
51-
podman run -d -p 9216:9216 -p 17001:17001 percona/mongodb_exporter:0.20 --mongodb.uri=mongodb://127.0.0.1:17001
55+
podman run -d -p 9216:9216 percona/mongodb_exporter:0.40 --mongodb.uri=mongodb://127.0.0.1:17001
5256

5357
# with docker
54-
docker run -d -p 9216:9216 -p 17001:17001 percona/mongodb_exporter:0.20 --mongodb.uri=mongodb://127.0.0.1:17001
58+
docker run -d -p 9216:9216 percona/mongodb_exporter:0.40 --mongodb.uri=mongodb://127.0.0.1:17001
5559
```
5660

5761
#### Permissions
@@ -91,11 +95,28 @@ You can run the exporter specifying multiple URIs, devided by a comma in --mongo
9195
```sh
9296
--mongodb.uri=mongodb://user:[email protected]:27017/admin,mongodb://user2:[email protected]:27018/admin
9397
```
94-
In this case you can use the **/scrape** endpoint with the **target** parameter to retreive the specified tartget's metrics. When querying the data you can use just mongodb://host:port in the targer parameter without other parameters and, of course without host credentials
98+
In this case you can use the **/scrape** endpoint with the **target** parameter to retreive the specified tartget's metrics. When querying the data you can use just mongodb://host:port in the target parameter without other parameters and, of course without host credentials
9599
```sh
96100
GET /scrape?target=mongodb://127.0.0.1:27018
97101
```
102+
If your URI is prefixed by mongodb:// or mongodb+srv:// schema, any host not prefixed by it after comma is being treated as part of a cluster rather then as a standalone host. Thus clusters and standalone hosts can be combined like this:
103+
```
104+
--mongodb.uri=mongodb+srv://user:pass@host1:27017,host2:27017,host3:27017/admin,mongodb://user2:pass2@host4:27018/admin
105+
```
106+
107+
You can use the --split-cluster option to split all cluster nodes into separate targets. This mode is useful when cluster nodes are defined as SRV records and the mongodb_exporter is running with mongodb+srv domain specified. In this case SRV records will be queried upon mongodb_exporter start and each cluster node can be queried using the **target** parameter of multitarget endpoint.
98108

109+
#### Overall targets request endpoint
110+
111+
There is an overall targets endpoint **/scrapeall** that queries all the targets in one request. It can be used to store multiple node metrics without separate target requests. In this case, each node metric will have a **instance** label containing the node name as a host:port pair (or just host if no port was not specified). For example, for mongodb_exporter running with the options:
112+
```
113+
--mongodb.uri="mongodb://host1:27015,host2:27016" --split-cluster=true
114+
```
115+
we get metrics like this:
116+
```
117+
mongodb_up{instance="host1:27015"} 1
118+
mongodb_up{instance="host2:27016"} 1
119+
```
99120

100121
#### Enabling collstats metrics gathering
101122
`--mongodb.collstats-colls` receives a list of databases and collections to monitor using collstats.

0 commit comments

Comments
 (0)