Skip to content

[data][inspector] Update buildTabularInspectorData to use new Datatable format, & implement in chart fns #83658

@lukeelmers

Description

@lukeelmers

Related to #83652

As explained in this comment, we have this buildTabularInspectorData function lingering around the data plugin. Currently it is only used by esaggs, specifically in the request handler which updates the inspector adapters with the request/response data so that it appears in the inspector view.

This was originally in place to support inspector in expressions, but at this point we can probably get rid of it. Rather, we should update buildTabularInspectorData to work with the new shared Datatable format. Then individual chart functions can log the final data to inspector (as further modifications could be happening after esaggs):

import { Datatable } from 'src/plugins/expressions/common';
import { TabularData } from 'src/plugins/inspector/common';

buildTabularInspectorData: (data: Datatable) => Promise<TabularData>

This could be exposed on the data plugin's runtime contract -- (probably on the search service? since we will likely move the inspector data updates to SearchSource) -- so that it can already know about filters & field formats. Usage would look something like:

  if (inspectorAdapters.data) {
    inspectorAdapters.data.setTabularLoader(
      () =>
        await data.search.buildTabularInspectorData(myChartDatatable),
      { returnsFormattedValues: true }
    );
  }

If we needed the ability to have the helper return unformatted values, we could add an option:

  if (inspectorAdapters.data) {
    inspectorAdapters.data.setTabularLoader(
      () =>
        await data.search.buildTabularInspectorData(myChartDatatable, { formatValues: false }),
      { returnsFormattedValues: false }
    );
  }

Tasks:

  1. Refactor buildTabularInspectorData to handle the new Datatable format and expose from data plugin contract
  2. Update the corresponding data inspector view so that the UI works with the new output of buildTabularInspectorData
  3. Remove the call to inspectorAdapters.data.setTabularLoader from esaggs and add it to each chart function instead
  4. Keep an eye out to make sure no circular dependencies are introduced (data depends on expressions and inspector, and expressions also depends on inspector)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:ExpressionLanguageInterpreter expression language (aka canvas pipeline)Feature:InspectorInspector infrastructure and implementationsFeature:SearchQuerying infrastructure in Kibanatechnical debtImprovement of the software architecture and operational architecture

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions