Reputation: 2706
I have an ALB with a single target group (this is an istio-ingress gateway), I want to capture a scenario where any request routed to this target group returns 5XX code.
Per docs:
HTTPCode_ELB_5XX_Count:
The number of HTTP 5XX server error codes that originate from the load balancer. This count does not include any response codes generated by the targets.
HTTPCode_Target_5XX_Count:
The number of HTTP response codes generated by the targets. This does not include any response codes generated by the load balancer.
I thought since this is a single target group they should be the same, but clearly they are not since for a particular time frame I see some data for HTTP 4XX but none for ELB 4XX. What's the difference? Which one should I use?
Upvotes: 12
Views: 10667
Reputation: 103
I assume it depends on a result you want to get. Because these errors work for different segments.
The first option (HTTPCode_ELB_5XX_Count
) returns errors which are produced when you touch the ELB itself. When by some reason it cannot redirect your traffic to a target group. I believe this would mean either an AWS issue or configuration issue.
When in the second case, it returns error from a service in your target group.
I believe both of them worth watching. But I think you would care more about the 2nd type of 5xx errors.
Upvotes: 5
Reputation: 12359
I think a diagram would be helpful to explain the difference. After a user sends a request to your backend, this is what your backend would do to send a response back to the user:
Targets (e.g. EC2) -(1)-> ALB -(2)-> user
HTTPCode_Target_5XX_Count
measures the number of 5XX responses generated by the targets only
HTTPCode_ELB_5XX_Count
measures the number of 5XX responses originating from the load balancer only
Note: HTTPCode_ELB_5XX_Count
does not include any response codes generated by the targets, and HTTPCode_Target_5XX_Count
does not include response codes originating from the load balancers. [source]
Note: The Target_5XX
is always included in the ELB_5XX
since the ALB forwards the error to the client. You can find more details about an ELB_5XX
which is not a Target_5XX
here.
Thanks Omar Kacimi for the correction!
Upvotes: 11
Reputation: 71
The diagram from @jellycsc is conceptually correct. However, according to: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html. The metrics are mutually exclusive. i.e. HTTPCode_ELB_4XX_Count is the count of only 4xx response codes from the load balancer and not the targets for example in case the load balancer does not know where to forward the request too. Similarly, HTTPCode_Target_4XX_Count represents only the count of 4xx responses from the target group and not the load balancer.
Upvotes: 5