How can I collect metrics from a Node.js application running in a Kubernetes cluster to monitor HTTP requests with status codes 5xx or 4xx?

30 views Asked by At

Currently, I have a Node.js API application running in an EKS cluster, which is connected to a service and an Ingress. Additionally, it communicates with an Nginx Ingress Controller within the cluster. Despite these configurations, I'm encountering issues accessing HTTP metrics directly from the pod. My goal is to obtain metrics such as the count of requests with 4XX or 5XX status codes. I've attempted to retrieve these metrics using Prometheus, which is also integrated into my cluster. However, my PromQL queries, such as http_requests_total{status!~"4.."}, haven't yielded any data. While I have access to metrics like kubelet_http_requests_total, kubelet_http_inflight_requests, and prometheus_http_requests_total, none of them provide specific information about the pod running the Node.js application.

I attempted to retrieve HTTP metrics using PromQL queries such as http_requests_total{status!~"4.."} in Prometheus, expecting to receive data regarding the number of requests with status codes excluding 4XX. However, despite these efforts, I didn't receive any data. Additionally, I explored alternative queries such as kubelet_http_requests_total, kubelet_http_inflight_requests, and prometheus_http_requests_total, hoping to find relevant metrics, but none of them provided specific information about the pod hosting the Node.js application.

0

There are 0 answers