[Infra] Create a data view client #180689
Labels
Feature:Metrics UI
Metrics UI feature
Feature:ObsHosts
Hosts feature within Observability
Feature:ObsInventory
Team:obs-ux-infra_services
Observability Infrastructure & Services User Experience Team
technical debt
Improvement of the software architecture and operational architecture
Summary
Inventory and Metrics UIs use
GET /api/metrics/source/{sourceId}
(via context) to retrieve the metric indices fields list, which is later used to render their corresponding search bars.The Hosts View doesn't need the fields list returned by
GET /api/metrics/source/{sourceId}
, yet it calls it to retrieve themetricAlias
(via context), which is later used to create an ad-hoc data-view (which also retrieves a list of fields)One problem with having
GET /api/metrics/source/{sourceId}
returning the fields list is that it increases the response size, and this endpoint should be only responsible for returning the Infra settings, not indices fields details, another problem is that code is old and it has a rather convoluted way to retrieve the fields list (see also the adapter code), making maintenance more challenging.Solution
Similar to Logs UI, and because ad-hoc data view also contains the fields list, the idea is to create a client responsible for creating an ad-hoc data view from the
metricsAlias
returned byGET /api/metrics/source/{sourceId}
.The client will replace the manual retrieval of the fields list used in the
GET /api/metrics/source/{sourceId}
and deprecate theuse_data_view
hook used in the hosts view, and will be used in the frontend.The text was updated successfully, but these errors were encountered: