forked from percona/proxysql_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request percona#10 from percona/develop
Release 1.1.0
- Loading branch information
Showing
1,141 changed files
with
331,858 additions
and
660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
proxysql_exporter | ||
vendor | ||
!vendor/vendor.json | ||
coverage.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
repository: | ||
path: github.com/percona/proxysql_exporter | ||
build: | ||
flags: -v -a -tags netgo | ||
ldflags: | | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Version={{.Version}} | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Revision={{.Revision}} | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Branch={{.Branch}} | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildUser={{user}}@{{host}} | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} | ||
tarball: | ||
files: | ||
- README.md | ||
- CHANGELOG.md | ||
- LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
dist: trusty | ||
sudo: required | ||
language: go | ||
|
||
go: | ||
- 1.7.x | ||
- 1.8.x | ||
- tip | ||
|
||
notifications: | ||
email: false | ||
env: | ||
- PROXYSQL_IMAGE=percona/proxysql:1.2.1 | ||
- PROXYSQL_IMAGE=perconalab/proxysql:1.3.6 | ||
|
||
services: | ||
- docker | ||
|
||
before_script: | ||
- docker --version | ||
- docker-compose --version | ||
- docker-compose up -d | ||
|
||
script: | ||
- go get github.com/kardianos/govendor | ||
- govendor sync | ||
- go test -v ./... | ||
- make format build testall | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
## v1.1.0 (2017-07-07) | ||
|
||
* Add all varaibles from `stats_mysql_global`. | ||
* Add all variables from `stats_mysql_connection_pool`. | ||
* Use https://github.com/prometheus/promu for building. | ||
* Use https://github.com/prometheus/common version to build with version information. | ||
|
||
## v1.0.1 (2017-05-23) | ||
|
||
* First tagged version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Contributing notes | ||
|
||
## Local setup | ||
|
||
The easiest way to make a local development setup is to use Docker Compose. | ||
|
||
``` | ||
docker-compose up | ||
make all testall | ||
export DATA_SOURCE_NAME='admin:admin@tcp(127.0.0.1:16032)/' | ||
./proxysql_exporter | ||
``` | ||
|
||
`testall` make target will run integration tests and also leave ProxySQL inside Docker container in configured state. | ||
|
||
|
||
## Vendoring | ||
|
||
We use [Glide](https://glide.sh) to vendor dependencies. Please use released version of Glide (i.e. do not `go get` | ||
from `master` branch). Also please use `--strip-vendor` flag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copyright 2015 The Prometheus Authors | ||
# Copyright 2017 Percona LLC | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
GO := go | ||
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) | ||
PROMU := $(FIRST_GOPATH)/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)) | ||
|
||
|
||
all: format build test | ||
|
||
style: | ||
@echo ">> checking code style" | ||
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^' | ||
|
||
test: | ||
@echo ">> running tests" | ||
@$(GO) test -v -short -race -coverprofile coverage.txt $(pkgs) | ||
|
||
testall: | ||
@echo ">> running all tests" | ||
@$(GO) test -v -race -coverprofile coverage.txt $(pkgs) | ||
|
||
format: | ||
@echo ">> formatting code" | ||
@$(GO) fmt $(pkgs) | ||
|
||
vet: | ||
@echo ">> vetting code" | ||
@$(GO) vet $(pkgs) | ||
|
||
build: promu | ||
@echo ">> building binaries" | ||
@$(PROMU) build --prefix $(PREFIX) | ||
|
||
tarball: promu | ||
@echo ">> building release tarball" | ||
@$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) | ||
|
||
docker: | ||
@echo ">> building docker image" | ||
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . | ||
|
||
promu: | ||
@GOOS=$(shell uname -s | tr A-Z a-z) \ | ||
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \ | ||
$(GO) get -u github.com/prometheus/promu | ||
|
||
|
||
.PHONY: all style format build test vet tarball docker promu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Percona ProxySQL Exporter. | ||
Copyright 2016-2017 Percona LLC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,84 @@ | ||
# Percona ProxySQL Exporter | ||
|
||
[](https://github.com/percona/proxysql_exporter/releases/latest) | ||
[](https://travis-ci.org/percona/proxysql_exporter) | ||
[](https://goreportcard.com/report/github.com/percona/proxysql_exporter) | ||
[](https://cla-assistant.io/percona/proxysql_exporter) | ||
|
||
Prometheus exporter for [ProxySQL](https://github.com/sysown/proxysql) performance data. | ||
Supported versions: 1.2 and 1.3. | ||
|
||
## Collectors | ||
|
||
* Global status metrics from `SHOW MYSQL STATUS` | ||
* Connection pool usage statistics from `stats_mysql_connection_pool` | ||
## Building and running | ||
|
||
## Build | ||
### Building | ||
|
||
``` | ||
GOOS=linux go build proxysql_exporter.go | ||
```bash | ||
make | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
export DATA_SOURCE_NAME="stats:stats@tcp(localhost:6032)/" | ||
./proxysql_exporter | ||
``` | ||
### Running | ||
|
||
The MySQL server's data source name must be set via the `DATA_SOURCE_NAME` environment variable. The format of this | ||
variable is described at https://github.com/go-sql-driver/mysql#dsn-data-source-name. | ||
|
||
To enable HTTP basic authentication, set environment variable `HTTP_AUTH` to user:password pair. | ||
For example: `export HTTP_AUTH="user:password"` | ||
To enable HTTP basic authentication, set environment variable `HTTP_AUTH` to user:password pair. Alternatively, you can | ||
use YAML file with `server_user` and `server_password` fields. | ||
|
||
```bash | ||
export DATA_SOURCE_NAME='stats:stats@tcp(127.0.0.1:42004)/' | ||
export HTTP_AUTH='user:password' | ||
./proxysql_exporter <flags> | ||
``` | ||
|
||
Note, using `stats` user requires ProxySQL 1.2.4 or higher. Otherwise, use `admin` user. | ||
|
||
## Visualize | ||
|
||
### Collector Flags | ||
|
||
Name | Description | ||
------------------------------|------------ | ||
collect.mysql_connection_pool | Collect from stats_mysql_connection_pool. | ||
collect.mysql_status | Collect from stats_mysql_global (SHOW MYSQL STATUS). | ||
|
||
|
||
### General Flags | ||
|
||
Name | Description | ||
-------------------------------------------|-------------------------------------------------------------------------------------------------- | ||
log.format | Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true" (default "logger:stderr") | ||
log.level | Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] | ||
version | Print version information and exit. | ||
web.auth-file | Path to YAML file with server_user, server_password options for http basic auth (overrides HTTP_AUTH env var). | ||
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/index.html) project, you can see the demo [here](https://pmmdemo.percona.com/graph/dashboard/db/proxysql-overview). | ||
|
||
## Submit Bug Report | ||
|
||
## 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. | ||
|
||
Your first step should be to search the existing set of open tickets for a similar report. If you find that someone else has already reported your problem, then you can upvote that report to increase its visibility. | ||
Your first step should be [to search](https://jira.percona.com/issues/?jql=project=PMM%20AND%20component=ProxySQL_Exporter) the existing set of open tickets for a similar report. If you find that someone else has already reported your problem, then you can upvote that report to increase its visibility. | ||
|
||
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. | ||
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. | ||
|
||
An excellent resource is [Elika Etemad's article on filing good bug reports.](http://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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# see CONTRIBUTING.md | ||
--- | ||
version: '3' | ||
services: | ||
proxysql: | ||
image: ${PROXYSQL_IMAGE:-perconalab/proxysql:1.3.6} | ||
environment: | ||
# those environment variables are not actually required by ProxySQL, but entrypoint erroneously checks them | ||
- CLUSTER_NAME=dummy | ||
- DISCOVERY_SERVICE=dummy | ||
ports: | ||
- 127.0.0.1:13306:3306 # user interface | ||
- 127.0.0.1:16032:6032 # admin interface | ||
mysql: | ||
image: mysql:5.7 | ||
environment: | ||
- MYSQL_ALLOW_EMPTY_PASSWORD=yes | ||
- MYSQL_USER=monitor | ||
- MYSQL_PASSWORD=monitor | ||
# ports: | ||
# - 127.0.0.1:23306:3306 | ||
percona-server: | ||
image: percona/percona-server:5.7 | ||
environment: | ||
- MYSQL_ALLOW_EMPTY_PASSWORD=yes | ||
- MYSQL_USER=monitor | ||
- MYSQL_PASSWORD=monitor | ||
# ports: | ||
# - 127.0.0.1:33306:3306 |
Oops, something went wrong.