Loading

Anypoint Monitoring: Custom Dashboards intermittently fail with 504 error on raw metric queries

Publiseringsdato: Aug 17, 2026
Beskrivelse

Symptom:
One or more Custom Dashboard panels in Anypoint Monitoring fail to load and display a 504 Network Error when the selected time range is set to 90 days(>30 days). The error occurs consistently every time the affected panel is loaded with a wide time window. Reducing the time range to 30 days or less may allow some panels to load, but panels with broad, unaggregated queries may still fail even at shorter ranges depending on data volume.

Error: 
504 Gateway Timeout Error

Løsning

Option 1: Add an aggregation function and a time bucket

Two changes are required together in the affected panel query:

  1. Wrap the selected metric field in an aggregation function:
    • Use mean() for average-type metrics (for example: response time).
    • Use sum() for count or total-type metrics (for example: request count).
  2. Add a time bucket to the GROUP BY clause which has the relevant tag dimension(s) (for example: time($_interval), time(5m), time(15m), time(1h))

Before (causes 504):

SELECT "<metric_field>"
FROM "<measurement>"
WHERE ("org_id" = '<org_id>' AND "app_id" = '<app_id>')
AND time >= now() - 90d
GROUP BY "<tag>"

After using mean() — resolves 504:

SELECT mean("<metric_field>")
FROM "<measurement>"
WHERE ("org_id" = '<org_id>' AND "app_id" = '<app_id>')
AND time >= now() - 90d
GROUP BY time(1h), "<tag>"

After using sum() — resolves 504:

SELECT sum("<metric_field>")
FROM "<measurement>"
WHERE ("org_id" = '<org_id>' AND "app_id" = '<app_id>')
AND time >= now() - 90d
GROUP BY time(1h), "<tag>"

Option 2 — Reduce the time range:
If aggregation is not suitable for the use case, reduce the dashboard time range to a shorter window (for example, the last 1 hour) and page through smaller time slices rather than querying a full 90-day window at once.


Option 3 — Narrow the query scope with additional WHERE filters:
Add more specific filters to the WHERE clause - for example, a particular application ID, endpoint, or response type - to reduce the volume of data scanned per request. This option can be combined with Option 1.


After applying any of the above changes, reload the dashboard with the 90-day time range and confirm the panels render without 504 errors. 

Knowledge-artikkelnummer

005391038

 
Laster
Salesforce Help | Article