This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a175e5b chore: modify metrics name apisix_bad_status_codes to 
apisix_status_codes (#1012)
3a175e5b is described below

commit 3a175e5b9a2c221641c74271eca94079d41501a3
Author: greenhandatsjtu <[email protected]>
AuthorDate: Wed May 11 11:13:12 2022 +0800

    chore: modify metrics name apisix_bad_status_codes to apisix_status_codes 
(#1012)
---
 docs/assets/other/json/apisix-ingress-controller-grafana.json | 4 ++--
 pkg/metrics/prometheus.go                                     | 2 +-
 pkg/metrics/prometheus_test.go                                | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/docs/assets/other/json/apisix-ingress-controller-grafana.json 
b/docs/assets/other/json/apisix-ingress-controller-grafana.json
index 77c27d2f..669d8bba 100644
--- a/docs/assets/other/json/apisix-ingress-controller-grafana.json
+++ b/docs/assets/other/json/apisix-ingress-controller-grafana.json
@@ -414,7 +414,7 @@
       "targets": [
         {
           "exemplar": true,
-          "expr": 
"sum(apisix_ingress_controller_apisix_bad_status_codes{status_code =~ 
\"[4-5].*\"}) / sum(apisix_ingress_controller_apisix_requests)",
+          "expr": 
"sum(apisix_ingress_controller_apisix_status_codes{status_code =~ \"[4-5].*\"}) 
/ sum(apisix_ingress_controller_apisix_requests)",
           "hide": false,
           "interval": "",
           "legendFormat": "",
@@ -595,7 +595,7 @@
       "targets": [
         {
           "exemplar": true,
-          "expr": "apisix_ingress_controller_apisix_bad_status_codes",
+          "expr": "apisix_ingress_controller_apisix_status_codes",
           "instant": false,
           "interval": "",
           "intervalFactor": 1,
diff --git a/pkg/metrics/prometheus.go b/pkg/metrics/prometheus.go
index f2a4d275..86686e7f 100644
--- a/pkg/metrics/prometheus.go
+++ b/pkg/metrics/prometheus.go
@@ -89,7 +89,7 @@ func NewPrometheusCollector() Collector {
                ),
                apisixCodes: prometheus.NewGaugeVec(
                        prometheus.GaugeOpts{
-                               Name:        "apisix_bad_status_codes",
+                               Name:        "apisix_status_codes",
                                Namespace:   _namespace,
                                Help:        "Status codes of requests to 
APISIX",
                                ConstLabels: constLabels,
diff --git a/pkg/metrics/prometheus_test.go b/pkg/metrics/prometheus_test.go
index dd5bafb0..72619173 100644
--- a/pkg/metrics/prometheus_test.go
+++ b/pkg/metrics/prometheus_test.go
@@ -23,9 +23,9 @@ import (
        "github.com/stretchr/testify/assert"
 )
 
-func apisixBadStatusCodesTestHandler(t *testing.T, metrics 
[]*io_prometheus_client.MetricFamily) func(*testing.T) {
+func apisixStatusCodesTestHandler(t *testing.T, metrics 
[]*io_prometheus_client.MetricFamily) func(*testing.T) {
        return func(t *testing.T) {
-               metric := 
findMetric("apisix_ingress_controller_apisix_bad_status_codes", metrics)
+               metric := 
findMetric("apisix_ingress_controller_apisix_status_codes", metrics)
                assert.NotNil(t, metric)
                assert.Equal(t, "GAUGE", metric.Type.String())
                m := metric.GetMetric()
@@ -218,7 +218,7 @@ func TestPrometheusCollector(t *testing.T) {
        metrics, err := prometheus.DefaultGatherer.Gather()
        assert.Nil(t, err)
 
-       t.Run("apisix_bad_status_codes", apisixBadStatusCodesTestHandler(t, 
metrics))
+       t.Run("apisix_status_codes", apisixStatusCodesTestHandler(t, metrics))
        t.Run("is_leader", isLeaderTestHandler(t, metrics))
        t.Run("apisix_request_latencies", apisixLatencyTestHandler(t, metrics))
        t.Run("apisix_requests", apisixRequestTestHandler(t, metrics))

Reply via email to