Fetch the HTTPS status from Dynatrace

There are builtin metrics for 4xx or 5xx error codes that you can use in metric events and get alerts on these.

If you need only the specific error codes I would suggest creating custom metrics that filter on those error codes only.

If you have traces on Grail you can pull the specific status codes on demand

fetch spans, from: -30m, to: now(), scanLimitGBytes: 2
|  filter in(http.response.status_code, {400, 404, 500, 503})
| summarize count(), by:{service.name, http.request.method ,http.response.status_code}