Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/prometheus/…
Browse files Browse the repository at this point in the history
…common-0.43.0
  • Loading branch information
Alex Tymchuk committed Jun 9, 2023
2 parents ef9803c + 6b6e5e5 commit c26d064
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 90 deletions.
99 changes: 47 additions & 52 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,60 @@
name: Go

on: [push, pull_request]
on:
push:
branches:
- main
- pmm-*
tags:
- v[0-9]+.[0-9]+.[0-9]+*

pull_request:

jobs:
test:
name: Test
strategy:
matrix:
go-version:
- 1.19
proxysql-image:
- percona/proxysql:1.2.1
- perconalab/proxysql:1.3.6
include:
- go-version: tip
os: ubuntu-latest
may-fail: true
runs-on: ubuntu-latest
steps:
- name: Set up Go release
if: matrix.go-version != 'tip'
uses: percona-platform/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Go tip
if: matrix.go-version == 'tip'
env:
# to avoid error due to `go version` accepting -v flag with an argument since 1.15
GOFLAGS: ""
run: |
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
echo "$HOME/gotip/bin" >> $GITHUB_PATH
- name: Checkout code
uses: percona-platform/checkout@v2
- name: Build
run: make build
- name: Run checks
run: |
go build -modfile=go.mod -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
go build -modfile=go.mod -o bin/reviewdog github.com/reviewdog/reviewdog/cmd/reviewdog
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
make format
git diff --exit-code
make build
- name: Run Tests
env:
PROXYSQL_IMAGE: ${{ matrix.proxysql-image }}
run: |
docker --version
docker-compose --version
docker-compose up -d
make testall
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
git status
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: ${{ github.workspace }}/go.mod

- name: Build
run: make build

- name: Run checks
run: |
go build -modfile=go.mod -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
go build -modfile=go.mod -o bin/reviewdog github.com/reviewdog/reviewdog/cmd/reviewdog
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
make format
git diff --exit-code
make build
- name: Run Tests
env:
PROXYSQL_IMAGE: ${{ matrix.proxysql-image }}
run: |
docker --version
docker-compose --version
docker-compose up -d
make testall
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
git status
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
GO := go
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
PROMU := bin/promu -v
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)

PREFIX ?= $(shell pwd)
BIN_DIR ?= $(shell pwd)
DOCKER_IMAGE_NAME ?= proxysql-exporter
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
PKGS ?= ./...

# Race detector is only supported on amd64.
RACE := $(shell test $$(go env GOARCH) != "amd64" || (echo "-race"))
Expand All @@ -33,23 +33,23 @@ all: format build test

style:
@echo ">> checking code style"
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
@! gofmt -d $(shell find . -path ./... -prune -o -name '*.go' -print) | grep '^'

test:
@echo ">> running tests"
@$(GO) test -v -short $(RACE) -coverprofile coverage.txt $(pkgs)
@$(GO) test -v -short $(RACE) -coverprofile coverage.txt $(PKGS)

testall:
@echo ">> running all tests"
@$(GO) test -v $(RACE) -coverprofile coverage.txt $(pkgs)
@$(GO) test -v $(RACE) -coverprofile coverage.txt $(PKGS)

format:
@echo ">> formatting code"
@$(GO) fmt $(pkgs)
@$(GO) fmt $(PKGS)

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

build: promu
@echo ">> building binaries"
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Percona ProxySQL Exporter.
Copyright 2016-2017 Percona LLC
Copyright 2023 Percona LLC
52 changes: 23 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Percona ProxySQL Exporter

[![Build Status](https://travis-ci.com/percona/proxysql_exporter.svg?branch=master)](https://travis-ci.com/percona/proxysql_exporter)
[![Build Status](https://github.com/percona/proxysql_exporter/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/percona/proxysql_exporter/actions/workflows/go.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/percona/proxysql_exporter)](https://goreportcard.com/report/github.com/percona/proxysql_exporter)
[![CLA assistant](https://cla-assistant.percona.com/readme/badge/percona/proxysql_exporter)](https://cla-assistant.percona.com/percona/proxysql_exporter)
Prometheus exporter for [ProxySQL](https://github.com/sysown/proxysql) performance data.
Supported versions: 1.2 and 1.3.


## Building and running

### Building
Expand All @@ -15,7 +14,6 @@ Supported versions: 1.2 and 1.3.
make
```


### Running

The MySQL server's data source name must be set via the `DATA_SOURCE_NAME` environment variable. The format of this
Expand All @@ -32,36 +30,32 @@ export HTTP_AUTH='user:password'

Note, using `stats` user requires ProxySQL 1.2.4 or higher. Otherwise, use `admin` user.


### Collector Flags

Name | Description
-------------------------------------------|------------
`collect.detailed.stats_mysql_processlist` | Collect detailed connection list from stats_mysql_processlist.
`collect.mysql_connection_list` | Collect connection list from stats_mysql_processlist. (default true)
`collect.mysql_connection_pool` | Collect from stats_mysql_connection_pool. (default true)
`collect.mysql_status` | Collect from stats_mysql_global (SHOW MYSQL STATUS). (default true)
`collect.runtime_mysql_servers` | Collect from runtime_mysql_servers - need admin credentials. (default false)
`collect.stats_memory_metrics` | Collect memory metrics from stats_memory_metrics.

| Name | Description |
| ------------------------------------------ | ---------------------------------------------------------------------------- |
| `collect.detailed.stats_mysql_processlist` | Collect detailed connection list from stats_mysql_processlist. |
| `collect.mysql_connection_list` | Collect connection list from stats_mysql_processlist. (default true) |
| `collect.mysql_connection_pool` | Collect from stats_mysql_connection_pool. (default true) |
| `collect.mysql_status` | Collect from stats_mysql_global (SHOW MYSQL STATUS). (default true) |
| `collect.runtime_mysql_servers` | Collect from runtime_mysql_servers - need admin credentials. (default false) |
| `collect.stats_memory_metrics` | Collect memory metrics from stats_memory_metrics. |

### General Flags

Name | Description
---------------------|------------
`version` | Print version information and exit.
`web.auth-file` | Path to YAML file with server_user, server_password keys for HTTP Basic authentication (overrides HTTP_AUTH environment variable).
`web.listen-address` | Address to listen on for web interface and telemetry. (default ":42004")
`web.ssl-cert-file` | Path to SSL certificate file.
`web.ssl-key-file` | Path to SSL key file.
`web.telemetry-path` | Path under which to expose metrics. (default "/metrics")

| Name | Description |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `version` | Print version information and exit. |
| `web.auth-file` | Path to YAML file with server_user, server_password keys for HTTP Basic authentication (overrides HTTP_AUTH environment variable). |
| `web.listen-address` | Address to listen on for web interface and telemetry. (default ":42004") |
| `web.ssl-cert-file` | Path to SSL certificate file. |
| `web.ssl-key-file` | Path to SSL key file. |
| `web.telemetry-path` | Path under which to expose metrics. (default "/metrics") |

## Visualizing

There is a Grafana dashboard for ProxySQL available as a part of [PMM](https://www.percona.com/doc/percona-monitoring-and-management/2.x/index.html) project, you can see the demo [here](https://pmmdemo.percona.com/graph/d/proxysql-instance-summary/proxysql-instance-summary).


## Submitting Bug Reports

If you find a bug in Percona ProxySQL Exporter or one of the related projects, you should submit a report to that project's [JIRA](https://jira.percona.com) issue tracker.
Expand All @@ -72,13 +66,13 @@ If there is no existing report, submit a report following these steps:

1. [Sign in to Percona JIRA.](https://jira.percona.com/login.jsp) You will need to create an account if you do not have one.
2. [Go to the Create Issue screen and select the relevant project.](https://jira.percona.com/secure/CreateIssueDetails!init.jspa?pid=11600&issuetype=1&priority=3&components=11601)
3. Fill in the fields of Summary, Description, Steps To Reproduce, and Affects Version to the best you can. If the bug corresponds to a crash, attach the stack trace from the logs.
3. Fill in the fields of Summary, Description, Steps To Reproduce, and Affects Version to the best you can. If the bug is due to a crash, attach the stack trace from the logs.

An excellent resource is [Elika Etemad's article on filing good bug reports.](http://fantasai.inkedblade.net/style/talks/filing-good-bugs/).
An excellent resource is [Elika Etemad's article on filing good bug reports.](https://fantasai.inkedblade.net/style/talks/filing-good-bugs/).

As a general rule of thumb, please try to create bug reports that are:

- *Reproducible.* Include steps to reproduce the problem.
- *Specific.* Include as much detail as possible: which version, what environment, etc.
- *Unique.* Do not duplicate existing tickets.
- *Scoped to a Single Bug.* One bug per report.
- _Reproducible._ Include steps to reproduce the problem.
- _Specific._ Include as much detail as possible: which version, what environment, etc.
- _Unique._ Do not duplicate existing tickets.
- _Scoped to a Single Bug._ One bug per report.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.1.2
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/percona/proxysql_exporter

go 1.19
go 1.20

require (
github.com/go-kit/log v0.2.1
Expand Down

0 comments on commit c26d064

Please sign in to comment.