[Metrics UI] /metadata should throw error if no features are found but data exists
#161384 opened on Jul 6, 2023
Description
Based on a recent support escalation, we found a situation where a customer had been dropping a key field (event.dataset) which the Metrics UI uses to decide which metrics to show in the Node Details page, causing the UI to simply break but without any errors.
The flow looks like this:
- UI resolves source config, and checks if there is any data
- Assuming there is data, it proceeds to ask the
/metadataendpoint for which features are "active" (for what are we collecting metrics data) - The list of features is a terms aggregation over
event.datasetto inform us of which metricsets are being collected and thus which metrics we should have available - The list of features is used in the follow up request when asking for the specific metrics to be aggregated to be displayed on the page
In the case where event.dataset is absent, no features are reported (though in this case all the metric fields still existed).
/metadata returns a 200 OK with an empty features list, which is translated to a request for no metrics, which also returns a 200 OK and the UI is simply empty.
I can see two ways to solve this, re-work the feature check to search for individual metric fields instead of the metricset. This is probably a lot of work, and might break some of the domain logic the Metrics UI tries to encapsulate. The other way is to treat no features as an error (assuming there is data), which should be a much smaller effort.
AC
/metadatathrow an error if no features are found when there is metrics data present- UI reports this error, giving hints that maybe some key field is missing for this UI to work