Skip to content

Commit 9922804

Browse files
authored
fix: update stub_status client path (#8690)
1 parent 154493f commit 9922804

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cmd/nginx-ingress/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ func createPlusAndLatencyCollectors(
952952
plusCollector = nginxCollector.NewNginxPlusCollector(plusClient, "nginx_ingress_nginxplus", variableLabelNames, constLabels, l)
953953
go metrics.RunPrometheusListenerForNginxPlus(ctx, *prometheusMetricsListenPort, plusCollector, registry, prometheusSecret)
954954
} else {
955-
httpClient := getSocketClient(filepath.Join(socketPath, "%s/nginx-status.sock"))
955+
httpClient := getSocketClient(filepath.Join(socketPath, "nginx-status.sock"))
956956
client := metrics.NewNginxMetricsClient(httpClient)
957957
go metrics.RunPrometheusListenerForNginx(ctx, *prometheusMetricsListenPort, client, registry, constLabels, prometheusSecret)
958958
}

tests/suite/test_prometheus_metrics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ class TestPrometheusExporter:
102102
'nginx_ingress_controller_workqueue_queue_duration_seconds_bucket{class="nginx",name="taskQueue",le=',
103103
'nginx_ingress_controller_workqueue_queue_duration_seconds_sum{class="nginx",name="taskQueue"}',
104104
'nginx_ingress_controller_workqueue_queue_duration_seconds_count{class="nginx",name="taskQueue"}',
105+
'nginx_ingress_nginx_connections_accepted{class="nginx"}',
106+
'nginx_ingress_nginx_connections_active{class="nginx"}',
107+
'nginx_ingress_nginx_connections_handled{class="nginx"}',
105108
],
106109
)
107110
],
@@ -113,6 +116,7 @@ def test_metrics(
113116
ingress_controller,
114117
expected_metrics,
115118
ingress_setup,
119+
cli_arguments,
116120
):
117121
ensure_connection(ingress_setup.req_url, 200, {"host": ingress_setup.ingress_host})
118122
resp = requests.get(ingress_setup.req_url, headers={"host": ingress_setup.ingress_host}, verify=False)
@@ -123,6 +127,9 @@ def test_metrics(
123127
assert resp.status_code == 200, f"Expected 200 code for /metrics but got {resp.status_code}"
124128
resp_content = resp.content.decode("utf-8")
125129
for item in expected_metrics:
130+
# Only assert NGINX OSS stub_status metrics for OSS builds
131+
if "nginx_ingress_nginx_connections" in item and cli_arguments["ic-type"] != "nginx-ingress":
132+
continue
126133
assert item in resp_content
127134

128135
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)