fix Status key conflic, fixes https://github.com/kubernetes/ingress-nginx/issues/3451
This commit is contained in:
parent
9d4060c463
commit
068d633e81
3 changed files with 3 additions and 3 deletions
|
@ -34,7 +34,7 @@ type upstream struct {
|
||||||
Latency float64 `json:"upstreamLatency"`
|
Latency float64 `json:"upstreamLatency"`
|
||||||
ResponseLength float64 `json:"upstreamResponseLength"`
|
ResponseLength float64 `json:"upstreamResponseLength"`
|
||||||
ResponseTime float64 `json:"upstreamResponseTime"`
|
ResponseTime float64 `json:"upstreamResponseTime"`
|
||||||
Status string `json:"upstreamStatus"`
|
//Status string `json:"upstreamStatus"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type socketData struct {
|
type socketData struct {
|
||||||
|
|
|
@ -34,7 +34,7 @@ local function metrics()
|
||||||
upstreamLatency = tonumber(ngx.var.upstream_connect_time) or -1,
|
upstreamLatency = tonumber(ngx.var.upstream_connect_time) or -1,
|
||||||
upstreamResponseTime = tonumber(ngx.var.upstream_response_time) or -1,
|
upstreamResponseTime = tonumber(ngx.var.upstream_response_time) or -1,
|
||||||
upstreamResponseLength = tonumber(ngx.var.upstream_response_length) or -1,
|
upstreamResponseLength = tonumber(ngx.var.upstream_response_length) or -1,
|
||||||
upstreamStatus = ngx.var.upstream_status or "-",
|
--upstreamStatus = ngx.var.upstream_status or "-",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ describe("Monitor", function()
|
||||||
|
|
||||||
monitor.flush()
|
monitor.flush()
|
||||||
|
|
||||||
local expected_payload = '[{"upstreamStatus":"200","requestLength":256,"ingress":"example","status":"200","service":"http-svc","requestTime":0.04,"namespace":"default","host":"example.com","method":"GET","upstreamResponseTime":0.02,"upstreamResponseLength":456,"endpoint":"10.10.0.1","upstreamLatency":0.01,"path":"\\/","responseLength":512},{"upstreamStatus":"200","requestLength":256,"ingress":"example","status":"201","service":"http-svc","requestTime":0.04,"namespace":"default","host":"example.com","method":"POST","upstreamResponseTime":0.02,"upstreamResponseLength":456,"endpoint":"10.10.0.1","upstreamLatency":0.01,"path":"\\/","responseLength":512}]'
|
local expected_payload = '[{"requestLength":256,"ingress":"example","status":"200","service":"http-svc","requestTime":0.04,"namespace":"default","host":"example.com","method":"GET","upstreamResponseTime":0.02,"upstreamResponseLength":456,"endpoint":"10.10.0.1","upstreamLatency":0.01,"path":"\\/","responseLength":512},{"requestLength":256,"ingress":"example","status":"201","service":"http-svc","requestTime":0.04,"namespace":"default","host":"example.com","method":"POST","upstreamResponseTime":0.02,"upstreamResponseLength":456,"endpoint":"10.10.0.1","upstreamLatency":0.01,"path":"\\/","responseLength":512}]'
|
||||||
|
|
||||||
assert.stub(tcp_mock.connect).was_called_with(tcp_mock, "unix:/tmp/prometheus-nginx.socket")
|
assert.stub(tcp_mock.connect).was_called_with(tcp_mock, "unix:/tmp/prometheus-nginx.socket")
|
||||||
assert.stub(tcp_mock.send).was_called_with(tcp_mock, expected_payload)
|
assert.stub(tcp_mock.send).was_called_with(tcp_mock, expected_payload)
|
||||||
|
|
Loading…
Reference in a new issue