1
0
mirror of https://github.com/nginxinc/nginx-prometheus-exporter.git synced 2025-04-18 12:45:02 +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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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**
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**
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

@ -198,4 +198,4 @@ 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.
limitations under the License.

View File

@ -8,10 +8,10 @@ import (
"net/http"
)
const templateMetrics string = `Active connections: %d
const templateMetrics string = `Active connections: %d
server accepts handled requests
%d %d %d
Reading: %d Writing: %d Waiting: %d
%d %d %d
Reading: %d Writing: %d Waiting: %d
`
// NginxClient allows you to fetch NGINX metrics from the stub_status page.

View File

@ -29,7 +29,6 @@ The dashboard comes with 2 rows with the following graphs for NGINX metrics:
* Status
* Up/Down graph per instance. It shows the `nginx_up` metric.
* 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.
* Total Requests with an irate (5 minutes range too) of the total number of client requests (`nginx_http_requests_total`) over time.

File diff suppressed because it is too large Load Diff