Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-12153 Upgrade mysqld exporter #268

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 0 additions & 113 deletions .circleci/config.yml

This file was deleted.

18 changes: 6 additions & 12 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,15 @@ jobs:
strategy:
matrix:
mysql-image:
- mysql/mysql-server:5.5
- mysql/mysql-server:5.6
- mysql/mysql-server:5.7
- mysql/mysql-server:8.0
- mariadb:5.5
- mariadb:10.0
- mariadb:10.1
- mariadb:10.2
- mariadb:10.3
- percona/percona-server:5.6
- mariadb:10.5
- mariadb:10.6
- mariadb:10.11
- mariadb:11.4
- percona/percona-server:5.7
- percona/percona-server:8.0
- percona:5.5
- percona:5.6
- percona/percona-server:8.4
- percona:5.7
- percona:8.0
runs-on: ubuntu-latest
Expand All @@ -43,8 +38,7 @@ jobs:

- name: Run checks
run: |
go build -modfile=tools/go.mod -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
go build -modfile=tools/go.mod -o bin/reviewdog github.com/reviewdog/reviewdog/cmd/reviewdog
make init
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
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

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/.build
/bin
/mysqld_exporter
/.release
/.tarballs

*.tar.gz
*.tar.{gz,xz}
*.test
*-stamp
.idea
Expand Down
8 changes: 8 additions & 0 deletions .golangci-required.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
---
linters-settings:
depguard:
rules:
main:
deny:
- pkg: "github.com/pkg/errors"
desc: use the "errors" package instead

# The most valuable linters; they are required to pass for PR to be merged.
linters:
disable-all: true
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
# Run only staticcheck for now. Additional linters will be enabled one-by-one.
linters:
enable:
- misspell
- staticcheck
- sloglint
disable-all: true
3 changes: 1 addition & 2 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
go:
# Whenever the Go version is updated here, .circle/config.yml should also
# be updated.
version: 1.21
version: 1.23
repository:
path: github.com/percona/mysqld_exporter
build:
flags: -a -tags netgo
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
Expand Down
9 changes: 3 additions & 6 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
extends: default
ignore: |
**/node_modules

rules:
braces:
Expand All @@ -20,9 +22,4 @@ rules:
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
check-keys: false
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,66 @@ Changes:
* [ENHANCEMENT]
* [BUGFIX]

## 0.16.0 / 2024-11-08

Changes:

* [CHANGE] Replace logging library go-kit/log with slog #875
* [FEATURE] Support for prometheus scrape timeout in probe endpoint #828
* [ENHANCEMENT] Support MySQL 8.4 replicas syntax #837
* [ENHANCEMENT] Fetch lock time and cpu time from performance schema #862
* [ENHANCEMENT] Add the instance struct to handle connections #859
* [ENHANCEMENT] Optimize code by using built-in constants in the standard lib #844
* [BUGFIX] Fix fetching tmpTables vs tmpDiskTables from performance_schema #853
* [BUGFIX] Skip SPACE_TYPE column for MariaDB >=10.5 #860
* [BUGFIX] Fixed parsing of timestamps with non-zero padded days #841
* [BUGFIX] Fix auto_increment metric collection errors caused by using collation in INFORMATION_SCHEMA searches #833
* [BUGFIX] Fix race condition in ReloadConfig #760
* [BUGFIX] Change processlist query to support ONLY_FULL_GROUP_BY sql_mode #684
* [BUGFIX] replication_applier_status_by_worker requires mysql 8.0 #683
* [BUGFIX] Update docker registry link in README.md #813
* [BUGFIX] Fix Docker run command and update documentation for cnf file handling #843
* [BUGFIX] info_schema_tables: do not collect the sys schema #879

## 0.15.1 / 2023-12-12

* Rebuild for dependency updates

## 0.15.0 / 2023-06-16

BREAKING CHANGES:

The exporter no longer supports the monolithic `DATA_SOURCE_NAME` environment variable.
To configure connections to MySQL you can either use a `my.cnf` style config file or command line arguments.

For example:

export MYSQLD_EXPORTER_PASSWORD=secret
mysqld_exporter --mysqld.address=localhost:3306 --mysqld.username=exporter

We have also dropped some internal scrape metrics:
- `mysql_exporter_scrapes_total`
- `mysql_exporter_scrape_errors_total`
- `mysql_last_scrape_failed`

The default client configuration file is now `.my.cnf` in the process working directory. Use `--config.my-cnf="$HOME/.my.cnf"` to retain the previous default.

Changes:

* [CHANGE] Allow `tlsCfg.InsecureSkipVerify` outside of mTLS #631
* [CHANGE] Update to exporter-toolkit v0.8.1 #677
* [CHANGE] Fix shared metrics between requests #722
* [CHANGE] Allow empty passwords #742
* [CHANGE] Don't use HOME env in the my-cnf config path. #745
* [FEATURE] Add support for collecting metrics from `sys.user_summary` #628
* [FEATURE] Support for multi-target mysqld probes #651
* [FEATURE] Add MySQL TLS configurations #718
* [FEATURE] Add config reload via /-/reload #734
* [ENHANCEMENT] Add UNIX domain socket support for multi-target scraping #707
* [ENHANCEMENT] Use `STRAIGHT_JOIN` in infoSchemaAutoIncrementQuery #726
* [BUGFIX] Fix `infoSchemaInnodbMetricsEnabledColumnQuery` #687
* [BUGFIX] Allow empty passwords #742

## 0.14.0 / 2022-01-05

BREAKING CHANGES:
Expand Down
39 changes: 22 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ PREFIX ?= $(shell pwd)
BIN_DIR ?= $(shell pwd)
DOCKER_IMAGE_NAME ?= mysqld-exporter
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
TMPDIR ?= $(shell dirname $(shell mktemp)/)
TMPDIR ?= $(shell dirname $(shell mktemp -d)/)

default: help

all: format build test-short

init: ## Install tools
rm -rf bin/*
cd tools && go generate -x -tags=tools

env-up: ## Start MySQL and copy ssl certificates to /tmp
@docker-compose up -d
@sleep 5
Expand All @@ -49,49 +53,50 @@ test: ## Run all tests
@echo ">> running tests"
@$(GO) test -race $(pkgs)

FILES = $(shell find . -type f -name '*.go')

format: ## Format the code
@echo ">> formatting code"
@$(GO) fmt $(pkgs)
@bin/goimports -local github.com/percona/pmm -l -w $(FILES)

FILES = $(shell find . -type f -name '*.go')

fumpt: ## Format source code using fumpt and fumports.
@gofumpt -w -s $(FILES)
@gofumports -local github.com/percona/mysqld_exporter -l -w $(FILES)
fumpt: ## Format source code using fumpt and goimports.
bin/gofumpt -l -w $(FILES)
bin/goimports -local github.com/percona/pmm -l -w $(FILES)

vet: ## Run vet
@echo ">> vetting code"
@$(GO) vet $(pkgs)

build: promu ## Build binaries
build: ## Build binaries
@echo ">> building binaries"
@$(PROMU) build --prefix $(PREFIX)

tarball: promu ## Build release tarball
tarball: ## Build release tarball
@echo ">> building release tarball"
@$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)

docker: ## Build docker image
@echo ">> building docker image"
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .

promu: ## Install promu
@GOOS=$(shell uname -s | tr A-Z a-z) \
GO111MODULE=on \
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
$(GO) build -modfile=tools/go.mod -o bin/promu github.com/prometheus/promu

help: ## Display this help message.
@echo "$(TMPDIR)"
@echo "Please use \`make <target>\` where <target> is one of:"
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n", $$1, $$2}'

GO_BUILD_LDFLAGS = -X github.com/prometheus/common/version.Version=$(shell cat VERSION) -X github.com/prometheus/common/version.Revision=$(shell git rev-parse HEAD) -X github.com/prometheus/common/version.Branch=$(shell git describe --always --contains --all) -X github.com/prometheus/common/version.BuildUser= -X github.com/prometheus/common/version.BuildDate=$(shell date +%FT%T%z) -s -w
GO_BUILD_LDFLAGS = -ldflags " \
-X github.com/prometheus/common/version.Version=$(shell cat VERSION) \
-X github.com/prometheus/common/version.Revision=$(shell git rev-parse HEAD) \
-X github.com/prometheus/common/version.Branch=$(shell git describe --always --contains --all) \
-X github.com/prometheus/common/version.BuildUser= \
-X github.com/prometheus/common/version.BuildDate=$(shell date +%FT%T%z) -s -w \
"

export PMM_RELEASE_PATH?=.

release:
go build -ldflags="$(GO_BUILD_LDFLAGS)" -o $(PMM_RELEASE_PATH)/mysqld_exporter
go build $(GO_BUILD_LDFLAGS) -o $(PMM_RELEASE_PATH)/mysqld_exporter

.PHONY: all style format build test vet tarball docker promu env-up env-down help default
.PHONY: all init style format build test vet tarball docker env-up env-down help default
Loading
Loading