1
0
mirror of https://github.com/nginxinc/nginx-prometheus-exporter.git synced 2025-07-31 21:04:21 +03:00

Add pre-commit and fix issues (#354)

This commit is contained in:
Luca Comellini
2023-02-01 09:07:22 -08:00
committed by GitHub
parent fafd46ca2c
commit 0c29bc879a
7 changed files with 606 additions and 567 deletions

View File

@ -24,4 +24,3 @@ A clear and concise description of what you expected to happen.
**Additional context** **Additional context**
Add any other context about the problem here. Any log files you want to share. Add any other context about the problem here. Any log files you want to share.

View File

@ -15,4 +15,3 @@ A clear and concise description of any alternative solutions or features you've
**Additional context** **Additional context**
Add any other context about the feature request here. Add any other context about the feature request here.

42
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,42 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-ast
- id: check-added-large-files
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs
- id: check-symlinks
- id: check-case-conflict
- id: check-vcs-permalinks
- id: check-json
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii]
- id: mixed-line-ending
args: [--fix=lf]
- id: no-commit-to-branch
- id: requirements-txt-fixer
- id: fix-byte-order-marker
- repo: local
hooks:
- id: golang-diff
name: create-go-diff
entry: bash -c 'git diff -p origin/main > /tmp/diff.patch'
language: system
types: [go]
pass_filenames: false
- repo: https://github.com/golangci/golangci-lint
rev: v1.50.1
hooks:
- id: golangci-lint
args: [--new-from-patch=/tmp/diff.patch]
ci:
skip: [golang-diff, golangci-lint]

View File

@ -32,4 +32,3 @@ The dashboard comes with 2 rows with the following graphs for NGINX metrics:
* Processed connections (`nginx_connections_accepted` and `nginx_connections_handled` metrics). This graph shows an [irate](https://prometheus.io/docs/prometheus/latest/querying/functions/#irate) in a range of 5 minutes. Useful for seeing the variation of the processed connections in time. * Processed connections (`nginx_connections_accepted` and `nginx_connections_handled` metrics). This graph shows an [irate](https://prometheus.io/docs/prometheus/latest/querying/functions/#irate) in a range of 5 minutes. Useful for seeing the variation of the processed connections in time.
* Active connections (`nginx_connections_active`, `nginx_connections_reading`, `nginx_connections_waiting` and `nginx_connections_writing`). Useful for checking what is happening right now. * Active connections (`nginx_connections_active`, `nginx_connections_reading`, `nginx_connections_waiting` and `nginx_connections_writing`). Useful for checking what is happening right now.
* Total Requests with an irate (5 minutes range too) of the total number of client requests (`nginx_http_requests_total`) over time. * Total Requests with an irate (5 minutes range too) of the total number of client requests (`nginx_http_requests_total`) over time.

View File

@ -1,37 +1,37 @@
{ {
"__inputs": [ "__inputs": [
{ {
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "", "description": "",
"type": "datasource", "label": "Prometheus",
"name": "DS_PROMETHEUS",
"pluginId": "prometheus", "pluginId": "prometheus",
"pluginName": "Prometheus" "pluginName": "Prometheus",
"type": "datasource"
} }
], ],
"__requires": [ "__requires": [
{ {
"type": "grafana",
"id": "grafana", "id": "grafana",
"name": "Grafana", "name": "Grafana",
"type": "grafana",
"version": "5.0.0" "version": "5.0.0"
}, },
{ {
"type": "panel",
"id": "graph", "id": "graph",
"name": "Graph", "name": "Graph",
"type": "panel",
"version": "" "version": ""
}, },
{ {
"type": "datasource",
"id": "prometheus", "id": "prometheus",
"name": "Prometheus", "name": "Prometheus",
"type": "datasource",
"version": "1.0.0" "version": "1.0.0"
}, },
{ {
"type": "panel",
"id": "singlestat", "id": "singlestat",
"name": "Singlestat", "name": "Singlestat",
"type": "panel",
"version": "" "version": ""
} }
], ],
@ -57,8 +57,8 @@
"links": [], "links": [],
"panels": [ "panels": [
{ {
"datasource": "${DS_PROMETHEUS}",
"collapsed": false, "collapsed": false,
"datasource": "${DS_PROMETHEUS}",
"gridPos": { "gridPos": {
"h": 1, "h": 1,
"w": 24, "w": 24,
@ -71,7 +71,6 @@
"type": "row" "type": "row"
}, },
{ {
"datasource": "${DS_PROMETHEUS}",
"cacheTimeout": null, "cacheTimeout": null,
"colorBackground": true, "colorBackground": true,
"colorPostfix": false, "colorPostfix": false,
@ -82,6 +81,7 @@
"#FF9830", "#FF9830",
"#299c46" "#299c46"
], ],
"datasource": "${DS_PROMETHEUS}",
"decimals": null, "decimals": null,
"description": "", "description": "",
"format": "none", "format": "none",
@ -166,8 +166,8 @@
"valueName": "current" "valueName": "current"
}, },
{ {
"datasource": "${DS_PROMETHEUS}",
"collapsed": false, "collapsed": false,
"datasource": "${DS_PROMETHEUS}",
"gridPos": { "gridPos": {
"h": 1, "h": 1,
"w": 24, "w": 24,
@ -180,11 +180,11 @@
"type": "row" "type": "row"
}, },
{ {
"datasource": "${DS_PROMETHEUS}",
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS}",
"decimals": null, "decimals": null,
"description": "", "description": "",
"fill": 1, "fill": 1,
@ -281,11 +281,11 @@
} }
}, },
{ {
"datasource": "${DS_PROMETHEUS}",
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS}",
"decimals": 0, "decimals": 0,
"fill": 1, "fill": 1,
"gridPos": { "gridPos": {
@ -392,11 +392,11 @@
} }
}, },
{ {
"datasource": "${DS_PROMETHEUS}",
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS}",
"fill": 1, "fill": 1,
"gridPos": { "gridPos": {
"h": 8, "h": 8,