Skip to content

Commit

Permalink
Merge pull request #1686 from driv/fix_nginx_query
Browse files Browse the repository at this point in the history
Fix Nginx request-duration query
  • Loading branch information
aryan9600 authored Jul 26, 2024
2 parents f38183b + 2d5e289 commit cff2032
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/metrics/observers/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var nginxQueries = map[string]string{
"request-duration": `
sum(
rate(
nginx_ingress_controller_ingress_upstream_latency_seconds_sum{
nginx_ingress_controller_response_duration_seconds_sum{
namespace="{{ namespace }}",
ingress="{{ ingress }}",
canary!=""
Expand All @@ -60,7 +60,7 @@ var nginxQueries = map[string]string{
/
sum(
rate(
nginx_ingress_controller_ingress_upstream_latency_seconds_count{
nginx_ingress_controller_response_duration_seconds_count{
namespace="{{ namespace }}",
ingress="{{ ingress }}",
canary!=""
Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/observers/nginx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestNginxObserver_GetRequestSuccessRate(t *testing.T) {
}

func TestNginxObserver_GetRequestDuration(t *testing.T) {
expected := ` sum( rate( nginx_ingress_controller_ingress_upstream_latency_seconds_sum{ namespace="nginx", ingress="podinfo", canary!="" }[1m] ) ) / sum( rate( nginx_ingress_controller_ingress_upstream_latency_seconds_count{ namespace="nginx", ingress="podinfo", canary!="" }[1m] ) ) * 1000`
expected := ` sum( rate( nginx_ingress_controller_response_duration_seconds_sum{ namespace="nginx", ingress="podinfo", canary!="" }[1m] ) ) / sum( rate( nginx_ingress_controller_response_duration_seconds_count{ namespace="nginx", ingress="podinfo", canary!="" }[1m] ) ) * 1000`

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
promql := r.URL.Query()["query"][0]
Expand Down

0 comments on commit cff2032

Please sign in to comment.