Skip to content

Commit

Permalink
PMM-10819 exporter update (#98)
Browse files Browse the repository at this point in the history
* Allow tlsCfg.InsecureSkipVerify outside of mTLS (prometheus#631)

Fix a bug where the `tlsCfg.InsecureSkipVerify` flag was only consumed when using mTLS.

Signed-off-by: GitHub <noreply@github.com>

* Update common Prometheus files (prometheus#636)

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Update build (prometheus#632)

* Update build to Go 1.18.
* Update to go 1.17 modules format.
* Add dependabot.
* Update upstream Prometheus repo configs.
* Fixup yamlllint.
* Update supported MySQL versions.

Signed-off-by: SuperQ <superq@gmail.com>

* Bump github.com/prometheus/client_golang from 1.12.1 to 1.12.2 (prometheus#637)

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.1 to 1.12.2.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.12.1...v1.12.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github.com/go-kit/log from 0.2.0 to 0.2.1 (prometheus#639)

Bumps [github.com/go-kit/log](https://github.com/go-kit/log) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/go-kit/log/releases)
- [Commits](go-kit/log@v0.2.0...v0.2.1)

---
updated-dependencies:
- dependency-name: github.com/go-kit/log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump gopkg.in/ini.v1 from 1.66.4 to 1.66.6 (prometheus#638)

Bumps [gopkg.in/ini.v1](https://github.com/go-ini/ini) from 1.66.4 to 1.66.6.
- [Release notes](https://github.com/go-ini/ini/releases)
- [Commits](go-ini/ini@v1.66.4...v1.66.6)

---
updated-dependencies:
- dependency-name: gopkg.in/ini.v1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fixup mixin linting (prometheus#646)

Update various items to make the mixin linter happy.

Signed-off-by: SuperQ <superq@gmail.com>

* Update common Prometheus files (prometheus#641)

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Bump github.com/prometheus/common from 0.34.0 to 0.35.0 (prometheus#645)

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.34.0 to 0.35.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](prometheus/common@v0.34.0...v0.35.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove ioutil (prometheus#650)

Signed-off-by: inosato <si17_21@yahoo.co.jp>

* Bump github.com/prometheus/common from 0.35.0 to 0.37.0 (prometheus#653)

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.35.0 to 0.37.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](prometheus/common@v0.35.0...v0.37.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* PMM-10277 Add tests for mysqld_exporter

* PMM-10277 yml fix

* PMM-10277 Test fix - ignore known metrics duplication

* PMM-10819 test update to ignore known metrics

* PMM-7 parallel replication state (#99)

* CI trigger

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: prombot <prometheus-team@googlegroups.com>
Signed-off-by: SuperQ <superq@gmail.com>
Signed-off-by: inosato <si17_21@yahoo.co.jp>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jordan Facibene <jordan@facibene.com>
Co-authored-by: PrometheusBot <prometheus-team@googlegroups.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: inosato <48383032+inosato@users.noreply.github.com>
  • Loading branch information
6 people authored Oct 24, 2022
1 parent 4055162 commit af9b532
Show file tree
Hide file tree
Showing 30 changed files with 1,569 additions and 109 deletions.
33 changes: 23 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ executors:
# should also be updated.
golang:
docker:
- image: circleci/golang:1.17
- image: cimg/go:1.18
jobs:
test:
executor: golang
Expand All @@ -18,10 +18,10 @@ jobs:
file: mysqld_exporter
integration:
docker:
- image: circleci/golang:1.17
- image: cimg/go:1.18
- image: << parameters.mysql_image >>
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_ROOT_HOST: '%'
parameters:
mysql_image:
Expand All @@ -35,10 +35,10 @@ jobs:
- run: make test
codespell:
docker:
- image: circleci/python
- image: cimg/python:3.10
steps:
- checkout
- run: sudo pip install codespell
- run: pip install codespell
- run: codespell --skip=".git,./vendor,ttar,Makefile.common" -L uint,ist,keypair
mixin:
executor: golang
Expand All @@ -59,19 +59,32 @@ workflows:
matrix:
parameters:
mysql_image:
- mysql/mysql-server:5.6
- percona:5.6
- mysql/mysql-server:5.7.33
- mysql/mysql-server:8.0
- mariadb:10.2
- mariadb:10.3
- mariadb:10.4
- mariadb:10.5
- mariadb:10.6
- mariadb:10.7
- prometheus/build:
name: build
parallelism: 3
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
filters:
tags:
only: /.*/
ignore: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: /^(main|release-.*|.*build-all.*)$/
- prometheus/build:
name: build_all
parallelism: 12
filters:
branches:
only: /^(main|release-.*|.*build-all.*)$/
tags:
only: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/

- codespell:
filters:
tags:
Expand All @@ -84,15 +97,15 @@ workflows:
context: org-context
requires:
- test
- build
- build_all
filters:
branches:
only: main
- prometheus/publish_release:
context: org-context
requires:
- test
- build
- build_all
filters:
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
Expand Down
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/golangci-lint-action@v3.1.0
uses: golangci/golangci-lint-action@v3.2.0
with:
version: v1.45.2
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@
.idea
*.iml
/vendor
/percona/tests/assets/mysqld_exporter
/percona/tests/assets/mysqld_exporter_percona
/percona/tests/assets/metrics.names.new.txt
/percona/tests/assets/metrics.names.old.txt
/percona/tests/assets/metrics.new.txt
/percona/tests/assets/metrics.old.txt
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Run only staticcheck for now. Additional linters will be enabled one-by-one.
linters:
enable:
- staticcheck
- staticcheck
disable-all: true
2 changes: 1 addition & 1 deletion .promu.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
go:
# Whenever the Go version is updated here, .circle/config.yml should also
# be updated.
version: 1.17
version: 1.18
repository:
path: github.com/percona/mysqld_exporter
build:
Expand Down
28 changes: 28 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
commas: disable
comments: disable
comments-indentation: disable
document-start: disable
indentation:
spaces: consistent
indent-sequences: consistent
key-duplicates:
ignore: |
config/testdata/section_key_dup.bad.yml
line-length: disable
truthy:
ignore: |
.github/workflows/codeql-analysis.yml
.github/workflows/funcbench.yml
.github/workflows/fuzzing.yml
.github/workflows/prombench.yml
.github/workflows/golangci-lint.yml
75 changes: 11 additions & 64 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,6 @@ GO_VERSION ?= $(shell $(GO) version)
GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))
PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.')

GOVENDOR :=
GO111MODULE :=
ifeq (, $(PRE_GO_111))
ifneq (,$(wildcard go.mod))
# Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI).
GO111MODULE := on

ifneq (,$(wildcard vendor))
# Always use the local vendor/ directory to satisfy the dependencies.
GOOPTS := $(GOOPTS) -mod=vendor
endif
endif
else
ifneq (,$(wildcard go.mod))
ifneq (,$(wildcard vendor))
$(warning This repository requires Go >= 1.11 because of Go modules)
$(warning Some recipes may not work as expected as the current Go runtime is '$(GO_VERSION_NUMBER)')
endif
else
# This repository isn't using Go modules (yet).
GOVENDOR := $(FIRST_GOPATH)/bin/govendor
endif
endif
PROMU := $(FIRST_GOPATH)/bin/promu
pkgs = ./...

Expand Down Expand Up @@ -150,58 +127,47 @@ common-check_license:
.PHONY: common-deps
common-deps:
@echo ">> getting dependencies"
ifdef GO111MODULE
GO111MODULE=$(GO111MODULE) $(GO) mod download
else
$(GO) get $(GOOPTS) -t ./...
endif
$(GO) mod download

.PHONY: update-go-deps
update-go-deps:
@echo ">> updating Go dependencies"
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
$(GO) get -d $$m; \
done
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
ifneq (,$(wildcard vendor))
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
endif
$(GO) mod tidy

.PHONY: common-test-short
common-test-short: $(GOTEST_DIR)
@echo ">> running short tests"
GO111MODULE=$(GO111MODULE) $(GOTEST) -short $(GOOPTS) $(pkgs)
$(GOTEST) -short $(GOOPTS) $(pkgs)

.PHONY: common-test
common-test: $(GOTEST_DIR)
@echo ">> running all tests"
GO111MODULE=$(GO111MODULE) $(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
$(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)

$(GOTEST_DIR):
@mkdir -p $@

.PHONY: common-format
common-format:
@echo ">> formatting code"
GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs)
$(GO) fmt $(pkgs)

.PHONY: common-vet
common-vet:
@echo ">> vetting code"
GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs)
$(GO) vet $(GOOPTS) $(pkgs)

.PHONY: common-lint
common-lint: $(GOLANGCI_LINT)
ifdef GOLANGCI_LINT
@echo ">> running golangci-lint"
ifdef GO111MODULE
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
# Otherwise staticcheck might fail randomly for some reason not yet explained.
GO111MODULE=$(GO111MODULE) $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
GO111MODULE=$(GO111MODULE) $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
else
$(GOLANGCI_LINT) run $(pkgs)
endif
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
endif

.PHONY: common-yamllint
Expand All @@ -218,28 +184,15 @@ endif
common-staticcheck: lint

.PHONY: common-unused
common-unused: $(GOVENDOR)
ifdef GOVENDOR
@echo ">> running check for unused packages"
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
else
ifdef GO111MODULE
common-unused:
@echo ">> running check for unused/missing packages in go.mod"
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
ifeq (,$(wildcard vendor))
$(GO) mod tidy
@git diff --exit-code -- go.sum go.mod
else
@echo ">> running check for unused packages in vendor/"
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
@git diff --exit-code -- go.sum go.mod vendor/
endif
endif
endif

.PHONY: common-build
common-build: promu
@echo ">> building binaries"
GO111MODULE=$(GO111MODULE) $(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)

.PHONY: common-tarball
common-tarball: promu
Expand Down Expand Up @@ -295,12 +248,6 @@ $(GOLANGCI_LINT):
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
endif

ifdef GOVENDOR
.PHONY: $(GOVENDOR)
$(GOVENDOR):
GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor
endif

.PHONY: precheck
precheck::

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Prometheus exporter for MySQL server metrics.

Supported versions:
* MySQL >= 5.6.
* MariaDB >= 10.2
* MariaDB >= 10.3

NOTE: Not all collection methods are supported on MySQL/MariaDB < 5.6

Expand Down
40 changes: 35 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
module github.com/percona/mysqld_exporter

go 1.17

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/go-kit/log v0.2.0
github.com/go-kit/log v0.2.1
github.com/go-sql-driver/mysql v1.6.0
github.com/google/uuid v1.3.0
github.com/prometheus/client_golang v1.12.1
github.com/montanaflynn/stats v0.6.6
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.12.2
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.32.1
github.com/prometheus/common v0.37.0
github.com/prometheus/exporter-toolkit v0.7.1
github.com/smartystreets/goconvey v1.7.2
github.com/stretchr/testify v1.4.0
github.com/tklauser/go-sysconf v0.3.10
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/ini.v1 v1.66.4
gopkg.in/ini.v1 v1.66.6
gopkg.in/yaml.v2 v2.4.0
)

go 1.15
require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.26.0 // indirect
)
Loading

0 comments on commit af9b532

Please sign in to comment.