diff --git a/internal/ingress/metric/collectors/socket.go b/internal/ingress/metric/collectors/socket.go index ed97393a6..00c780d31 100644 --- a/internal/ingress/metric/collectors/socket.go +++ b/internal/ingress/metric/collectors/socket.go @@ -30,11 +30,10 @@ import ( ) type upstream struct { - Endpoint string `json:"endpoint"` Latency float64 `json:"upstreamLatency"` ResponseLength float64 `json:"upstreamResponseLength"` ResponseTime float64 `json:"upstreamResponseTime"` - Status string `json:"upstreamStatus"` + //Status string `json:"upstreamStatus"` } type socketData struct { @@ -88,8 +87,6 @@ var ( "method", "path", - // "endpoint", - "namespace", "ingress", "service", @@ -223,11 +220,10 @@ func (sc *SocketCollector) handleMessage(msg []byte) { } requestLabels := prometheus.Labels{ - "host": stats.Host, - "status": stats.Status, - "method": stats.Method, - "path": stats.Path, - //"endpoint": stats.Endpoint, + "host": stats.Host, + "status": stats.Status, + "method": stats.Method, + "path": stats.Path, "namespace": stats.Namespace, "ingress": stats.Ingress, "service": stats.Service, diff --git a/rootfs/etc/nginx/lua/monitor.lua b/rootfs/etc/nginx/lua/monitor.lua index 12d538617..a63ddc75c 100644 --- a/rootfs/etc/nginx/lua/monitor.lua +++ b/rootfs/etc/nginx/lua/monitor.lua @@ -30,11 +30,10 @@ local function metrics() requestTime = tonumber(ngx.var.request_time) or -1, responseLength = tonumber(ngx.var.bytes_sent) or -1, - endpoint = ngx.var.upstream_addr or "-", upstreamLatency = tonumber(ngx.var.upstream_connect_time) or -1, upstreamResponseTime = tonumber(ngx.var.upstream_response_time) or -1, upstreamResponseLength = tonumber(ngx.var.upstream_response_length) or -1, - upstreamStatus = ngx.var.upstream_status or "-", + --upstreamStatus = ngx.var.upstream_status or "-", } end diff --git a/rootfs/etc/nginx/lua/test/monitor_test.lua b/rootfs/etc/nginx/lua/test/monitor_test.lua index 08f7fcd24..8796d0a62 100644 --- a/rootfs/etc/nginx/lua/test/monitor_test.lua +++ b/rootfs/etc/nginx/lua/test/monitor_test.lua @@ -96,7 +96,7 @@ describe("Monitor", function() 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,"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,"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.send).was_called_with(tcp_mock, expected_payload)