Skip to content

Commit

Permalink
refactor!: metric names as suggested here prometheus/docs#2386 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis authored Nov 21, 2023
1 parent e5e1930 commit 427b4dd
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Run chart-testing (lint)
run: ct lint --target-branch=master --chart-dirs chart --check-version-increment=false
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Create kind cluster
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./saml-exporter
saml-exporter
goreportcard.db
./config.yaml
coverage.out
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ The exporter can be configured by either command line flags (`saml-exporter -h`)
| Name | Description | Type | Labels |
|--------------------------|------------------------------------------|---------|-----------|
| `saml_exporter_build_info` | Build info SAML exporter | `Gauge` | `"branch", "goversion", "revision", "revision"` |
| `http_client_request_total` | HTTP client request | `Counter` | `"host", "code", "method"` |
| `saml_metadata_error_total` | Errors encountered while parsing SAML metadata | `Counter` | `"url"` |
| `saml_x509_read_error_total` | Errors encountered while parsing SAML X509 certificates | `Counter` | `"entityid", "use"` |
| `saml_x509_cert_not_after` | SAML X509 certificate expiration date | `Gauge` | `"entityid", "use", "serial_number", "issuer_C", "issuer_CN", "issuer_L", "issuer_O", "issuer_ST", "subject_C", "subject_CN", "subject_L", "subject_O"` |
| `saml_x509_cert_not_before` | SAML X509 certificate not valid before | `Gauge` | `"entityid", "use", "serial_number", "issuer_C", "issuer_CN", "issuer_L", "issuer_O", "issuer_ST", "subject_C", "subject_CN", "subject_L", "subject_O"` |
| `http_client_requests_total` | HTTP client request | `Counter` | `"host", "code", "method"` |
| `saml_metadata_errors_total` | Errors encountered while parsing SAML metadata | `Counter` | `"url"` |
| `saml_x509_read_errors_total` | Errors encountered while parsing SAML X509 certificates | `Counter` | `"entityid", "use"` |
| `saml_x509_cert_not_valid_after` | SAML X509 certificate expiration date | `Gauge` | `"entityid", "use", "serial_number", "issuer_C", "issuer_CN", "issuer_L", "issuer_O", "issuer_ST", "subject_C", "subject_CN", "subject_L", "subject_O"` |
| `saml_x509_cert_not_valid_before` | SAML X509 certificate not valid before | `Gauge` | `"entityid", "use", "serial_number", "issuer_C", "issuer_CN", "issuer_L", "issuer_O", "issuer_ST", "subject_C", "subject_CN", "subject_L", "subject_O"` |

## Grafana dashboard

Expand Down
44 changes: 22 additions & 22 deletions chart/saml-exporter/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"datasource": {
"uid": "${DS_PROMETHEUS}"
},
"expr": "count(saml_x509_cert_not_after)",
"expr": "count(saml_x509_cert_not_valid_after)",
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
Expand Down Expand Up @@ -170,7 +170,7 @@
"datasource": {
"uid": "${DS_PROMETHEUS}"
},
"expr": "sum(((saml_x509_cert_not_after - time()) / 86400) < bool 0)",
"expr": "sum(((saml_x509_cert_not_valid_after - time()) / 86400) < bool 0)",
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
Expand Down Expand Up @@ -235,7 +235,7 @@
"datasource": {
"uid": "${DS_PROMETHEUS}"
},
"expr": "sum(0 < ((saml_x509_cert_not_after - time()) / 86400) < bool $critical_threshold)",
"expr": "sum(0 < ((saml_x509_cert_not_valid_after - time()) / 86400) < bool $critical_threshold)",
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
Expand Down Expand Up @@ -302,7 +302,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "count(sum(rate(http_client_request_total{code!~\"^2.*\", job=~\".*/saml-exporter\"}[$__rate_interval])) by (host)) or vector(0)",
"expr": "count(sum(rate(http_client_requests_total{code!~\"^2.*\", job=~\".*/saml-exporter\"}[$__rate_interval])) by (host)) or vector(0)",
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
Expand Down Expand Up @@ -370,7 +370,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "(count(count(saml_x509_cert_not_after) by (entityid) - count(((saml_x509_cert_not_after - time()) / 86400) < $critical_threshold) by (entityid) == 0)) or vector(0)",
"expr": "(count(count(saml_x509_cert_not_valid_after) by (entityid) - count(((saml_x509_cert_not_valid_after - time()) / 86400) < $critical_threshold) by (entityid) == 0)) or vector(0)",
"interval": "",
"legendFormat": "{{entityid}}",
"queryType": "randomWalk",
Expand Down Expand Up @@ -500,7 +500,7 @@
"datasource": {
"uid": "${DS_PROMETHEUS}"
},
"expr": "sum(0 < ((saml_x509_cert_not_after - time()) / 86400) < bool $warning_threshold)",
"expr": "sum(0 < ((saml_x509_cert_not_valid_after - time()) / 86400) < bool $warning_threshold)",
"instant": false,
"interval": "",
"legendFormat": "",
Expand Down Expand Up @@ -568,7 +568,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "(sum(saml_x509_read_error_total) or vector(0)) + (sum(saml_metadata_error_total) or vector(0))",
"expr": "(sum(saml_x509_read_errors_total) or vector(0)) + (sum(saml_metadata_errors_total) or vector(0))",
"instant": false,
"interval": "",
"legendFormat": "",
Expand Down Expand Up @@ -711,7 +711,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sort(((saml_x509_cert_not_after{} - time()) / 86400) < $list_threshold)",
"expr": "sort(((saml_x509_cert_not_valid_after{} - time()) / 86400) < $list_threshold)",
"format": "table",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -832,7 +832,7 @@
"datasource": {
"uid": "${DS_PROMETHEUS}"
},
"expr": "topk(10, sort_desc(count by (issuer_CN) (saml_x509_cert_not_after)))",
"expr": "topk(10, sort_desc(count by (issuer_CN) (saml_x509_cert_not_valid_after)))",
"format": "table",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -956,7 +956,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "bottomk(10, (saml_x509_cert_not_after{} - saml_x509_cert_not_before) / 86400)",
"expr": "bottomk(10, (saml_x509_cert_not_valid_after{} - saml_x509_cert_not_valid_before) / 86400)",
"format": "table",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -1066,7 +1066,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(10, (saml_x509_cert_not_after - saml_x509_cert_not_before) / 86400)",
"expr": "topk(10, (saml_x509_cert_not_valid_after - saml_x509_cert_not_valid_before) / 86400)",
"format": "table",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -1209,7 +1209,7 @@
"uid": "RVra6BSnk"
},
"editorMode": "code",
"expr": "sum(rate(http_client_request_total{job=~\".*/saml-exporter\"}[$__rate_interval])) by (code, host)",
"expr": "sum(rate(http_client_requests_total{job=~\".*/saml-exporter\"}[$__rate_interval])) by (code, host)",
"legendFormat": "{{host}}: {{code}}",
"range": true,
"refId": "A"
Expand Down Expand Up @@ -1295,7 +1295,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum((saml_x509_read_error_total or vector(0)) > bool 0)",
"expr": "sum((saml_x509_read_errors_total or vector(0)) > bool 0)",
"interval": "",
"legendFormat": "Certificate parsing errors",
"queryType": "randomWalk",
Expand All @@ -1308,7 +1308,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum((saml_metadata_error_total or vector(0)) > bool 0)",
"expr": "sum((saml_metadata_errors_total or vector(0)) > bool 0)",
"hide": false,
"legendFormat": "Metadata parsing errors",
"range": true,
Expand Down Expand Up @@ -1400,7 +1400,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(saml_x509_read_error_total) or vector(0)",
"expr": "sum(saml_x509_read_errors_total) or vector(0)",
"interval": "",
"legendFormat": "Certificate parsing errors",
"queryType": "randomWalk",
Expand All @@ -1413,7 +1413,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(saml_metadata_error_total) or vector(0)",
"expr": "sum(saml_metadata_errors_total) or vector(0)",
"hide": false,
"legendFormat": "Metadata parsing errors",
"range": true,
Expand Down Expand Up @@ -1506,7 +1506,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(rate(saml_x509_read_error_total[$__rate_interval])) or vector(0)",
"expr": "sum(rate(saml_x509_read_errors_total[$__rate_interval])) or vector(0)",
"interval": "",
"legendFormat": "Certificate parsing errors",
"queryType": "randomWalk",
Expand All @@ -1519,7 +1519,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(rate(saml_metadata_error_total[$__rate_interval])) or vector(0)",
"expr": "sum(rate(saml_metadata_errors_total[$__rate_interval])) or vector(0)",
"hide": false,
"legendFormat": "Metadata parsing errors",
"range": true,
Expand Down Expand Up @@ -1632,7 +1632,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(10, saml_x509_read_error_total)",
"expr": "topk(10, saml_x509_read_errors_total)",
"format": "table",
"instant": true,
"interval": "",
Expand All @@ -1646,7 +1646,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(10, saml_metadata_error_total)",
"expr": "topk(10, saml_metadata_errors_total)",
"hide": false,
"legendFormat": "__auto",
"range": true,
Expand Down Expand Up @@ -1751,7 +1751,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(10, rate(saml_x509_read_error_total[6h]))",
"expr": "topk(10, rate(saml_x509_read_errors_total[6h]))",
"format": "table",
"instant": true,
"interval": "",
Expand All @@ -1765,7 +1765,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(10, rate(saml_metadata_error_total[6h]))",
"expr": "topk(10, rate(saml_metadata_errors_total[6h]))",
"hide": false,
"legendFormat": "__auto",
"range": true,
Expand Down
2 changes: 1 addition & 1 deletion config/tests/cases/idp-metadata/verify-get-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
- /bin/sh
- "-c"
- |
curl --fail -vvv http://saml-exporter/metrics | grep 'saml_x509_cert_not_after'
curl --fail -vvv http://saml-exporter/metrics | grep 'saml_x509_cert_not_valid_after'
resources: {}
securityContext:
allowPrivilegeEscalation: false
Expand Down
Loading

0 comments on commit 427b4dd

Please sign in to comment.