8000 Add pre-commit and fix issues · nginx/nginx-prometheus-exporter@dfc8833 · GitHub
[go: up one dir, main page]

Skip to content

Commit dfc8833

Browse files
committed
Add pre-commit and fix issues
1 parent c492cd6 commit dfc8833

File tree

8 files changed

+610
-550
lines changed

8 files changed

+610
-550
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ A clear and concise description of what you expected to happen.
2424

2525
**Additional context**
2626
Add any other context about the problem here. Any log files you want to share.
27-

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ A clear and concise description of any alternative solutions or features you've
1515

1616
**Additional context**
1717
Add any other context about the feature request here.
18-

.github/workflows/pre-commit.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: pre-commit
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
pre-commit:
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
17+
with:
18+
python-version: 3.x
19+
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
20+
- uses: pre-commit-ci/lite-action@50143aaf27e2c42e75a5e06185a471d9582e89df # v1.0.0
21+
if: always()

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.4.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
args: [--allow-multiple-documents]
11+
- id: check-ast
12+
- id: check-added-large-files
13+
- id: check-merge-conflict
14+
- id: check-shebang-scripts-are-executable
15+
- id: check-executables-have-shebangs
16+
- id: check-symlinks
17+
- id: check-case-conflict
18+
- id: check-vcs-permalinks
19+
- id: check-json
20+
- id: pretty-format-json
21+
args: [--autofix, --no-ensure-ascii]
22+
- id: mixed-line-ending
23+
args: [--fix=lf]
24+
- id: no-commit-to-branch
25+
- id: requirements-txt-fixer
26+
- id: fix-byte-order-marker
27+
- repo: local
28+
hooks:
29+
- id: golang-diff
30+
name: create-go-diff
31+
entry: bash -c 'git diff -p origin/main > /tmp/diff.patch'
32+
language: system
33+
types: [go]
34+
pass_filenames: false
35+
- repo: https://github.com/golangci/golangci-lint
36+
rev: v1.50.1
37+
hooks:
38+
- id: golangci-lint
39+
args: [--new-from-patch=/tmp/diff.patch]
40+
41+
ci:
42+
skip: [golang-diff, golangci-lint]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@ Unless required by applicable law or agreed to in writing, software
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

client/nginx.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
"net/http"
99
)
1010

11-
const templateMetrics string = `Active connections: %d
11+
const templateMetrics string = `Active connections: %d
1212
server accepts handled requests
13-
%d %d %d
14-
Reading: %d Writing: %d Waiting: %d
13+
%d %d %d
14+
Reading: %d Writing: %d Waiting: %d
1515
`
1616

1717
// NginxClient allows you to fetch NGINX metrics from the stub_status page.

grafana/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ The dashboard comes with 2 rows with the following graphs for NGINX metrics:
2929
* Status
3030
* Up/Down graph per instance. It shows the `nginx_up` metric.
3131
* Metrics
32-
* 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.
32+
* 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.
3333
* Active connections (`nginx_connections_active`, `nginx_connections_reading`, `nginx_connections_waiting` and `nginx_connections_writing`). Useful for checking what is happening right now.
3434
* Total Requests with an irate (5 minutes range too) of the total number of client requests (`nginx_http_requests_total`) over time.
35-

0 commit comments

Comments
 (0)
0