-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Infra] Deprecate fields returned by the /api/metrics/source
endpoint, in favor of ad hoc data views
#181954
[Infra] Deprecate fields returned by the /api/metrics/source
endpoint, in favor of ad hoc data views
#181954
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
50bb70e
to
63ea9bb
Compare
/ci |
63ea9bb
to
33899c1
Compare
e56ab19
to
a511639
Compare
/ci |
@@ -8,83 +8,76 @@ | |||
import { EuiButton, EuiComboBox, EuiForm, EuiFormRow } from '@elastic/eui'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it a functional component
@@ -15,193 +15,176 @@ import { | |||
import { i18n } from '@kbn/i18n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it a functional component
a511639
to
a7eb928
Compare
@elasticmachine merge upstream |
/ci |
return <SourceLoadingPage />; | ||
} | ||
|
||
return ( | ||
<MetricsPageTemplate | ||
<PageTemplate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want all the validations that happen in <MetricsPageTemplate />
in the Settings page
return ( | ||
<MetricsPageTemplate | ||
<PageTemplate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want all the validations that happen in <MetricsPageTemplate />
in the Settings page
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
/api/metrics/source
endpoint, in favor of ad hoc data views
@elasticmachine merge upstream |
services: { dataViews }, | ||
} = useKibanaContextForPlugin(); | ||
|
||
const { source } = useSourceContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're planning to remove the index pattern from here we could replace this with something that fetches for the index pattern in the metrics data access plugin. Is that what you're thinking to do in a follow up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly, this will be removed once we have a new endpoint to return the index pattern from metrics data access plugin
@@ -120,15 +120,12 @@ export const defaultExpression = { | |||
|
|||
export const Expressions: React.FC<Props> = (props) => { | |||
const { setRuleParams, ruleParams, errors, metadata } = props; | |||
const { source, createDerivedIndexPattern } = useSourceContext(); | |||
const { source } = useSourceContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this being used here? seems like we may not need it with the inclusion of metricsView.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. we need the sourceId
. Should we create a ticket to stop using this attribute? I don't really see the point of having it in the current solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, missed that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elastic/obs-ux-management-team we might want to log the ticket Carlos mentions here and get rid of the source entirely if it's no longer used/needed, in favor of data views
} = useKibanaContextForPlugin(); | ||
|
||
const { value: filters = [] } = useAsync(async () => { | ||
const resolvedDataView = await resolveDataView({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the reasoning behind using this instead of useMetricsDataViewContext().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's because we need to retrieve the logs data view too for the logs rate chart.
This chart component is data view agnostic and it depends on the index pattern information that the chart objects hold. This is only needed to build filters in a way that they look nicer when the user opens the chart in Lens. If it wasn't for that, this whole section could've been removed.
Thanks for tackling this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I added some nits/questions.
<DropdownButton | ||
label={i18n.translate('xpack.infra.waffle.groupByLabel', { defaultMessage: 'Group by' })} | ||
onClick={togglePopover} | ||
data-test-subj={'waffleGroupByDropdown'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
data-test-subj={'waffleGroupByDropdown'} | |
data-test-subj="waffleGroupByDropdown" |
name?: string; | ||
} | ||
|
||
export async function resolveDataView({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need async
here?
@@ -12,7 +12,7 @@ import { | |||
type Filter, | |||
isCombinedFilter, | |||
} from '@kbn/es-query'; | |||
import type { DataView } from '@kbn/data-views-plugin/common'; | |||
import { DataView } from '@kbn/data-views-plugin/common'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed?
@@ -17,8 +17,8 @@ import { MetricK8sModuleProvider } from '../../../containers/ml/modules/metrics_ | |||
import { useActiveKibanaSpace } from '../../../hooks/use_kibana_space'; | |||
|
|||
export const AnomalyDetectionFlyout = ({ | |||
hideJobType, | |||
hideSelectGroup, | |||
hideJobType = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need those default values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better than letting them be undefined
in case it's not informed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked because we have them as optional also in other places where we check the value but it's Ok to have them set to false by default.
timestamps: MetricsExplorerTimestamp; | ||
enabled?: boolean; | ||
}) { | ||
// Your code logic here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this comment?
// Your code logic here |
…e-fields-from-source-endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯 Thanks for the fixes!
@crespocarlos I'm having difficulties to see data in the Inventory pages using the edge-oblt and edge-oblt-lite. Which one should I use? |
Hi @kdelemme . It should work with both. If pointing your local instance to an oblt cluster, check if you've configured the index pattern in the settings page. value: |
Ah thanks ! Forgot about this.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change LGTM
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Canvas Sharable Runtime
Page load bundle
History
To update your PR or re-run it, just comment with: |
…nt, in favor of ad hoc data views (elastic#181954) closes [elastic#180689](elastic#180689) ## Summary This PR lays the necessary foundation to deprecate the indices [fields list attribute retrieved and returned](https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability_solution/infra/server/routes/metrics_sources/index.ts#L38) by the `api/metrics/source` endpoint and affects all infra pages. Now instead of the Metrics UI and Inventory UI relying on that attribute to build the list of suggestions in their search bars, an adhoc data view will be created from the `metricsAlias` returned by the same endpoint. The data view object contains everything that's needed with the benefit of allowing us to make async requests and cache, provided by Data Views Service. This will allow us to start moving away from `api/metrics/source` to retrieve information critical to the loading of the pages. It's a big PR, and the changes affect mostly the search bars, field name selectors, and charts across infra. Besides, it also contains - Storybook fix. - Some components were turned into functional components - `<MetricsPageTemplate />` now encapsulates error messages and is only used in Infrastructure pages - Improvement of the Infrastructure routing code. - Data View provider common to all infra pages - `SourceProvider` refactor. <img width="921" alt="image" src="https://github.com/elastic/kibana/assets/2767137/ceb781ed-2464-4f67-93e4-7013786830d4"> <img width="921" alt="image" src="https://github.com/elastic/kibana/assets/2767137/169f6f6b-03da-48e3-86b8-449bad1b2035"> <img width="921" alt="image" src="https://github.com/elastic/kibana/assets/2767137/3e5b8394-ead2-40bb-ad00-609b29b179e5"> <img width="921" alt="image" src="https://github.com/elastic/kibana/assets/2767137/34639ebf-af75-46e3-840b-8aa89951ae6e"> <img width="921" alt="image" src="https://github.com/elastic/kibana/assets/2767137/b6ff3b96-219b-4daa-bc33-f9fd36912a5d"> <img width="921" alt="image" src="https://github.com/elastic/kibana/assets/2767137/437cb7b8-62a6-4e1a-b94e-41055ab71bc1"> <img width="921" alt="image" src="https://github.com/elastic/kibana/assets/2767137/72f04712-7ee1-44fc-990e-83f0fbff7115"> ## How to test - Start a local kibana instance pointing to an Oblt cluster - Navigate to Inventory, and all its pages, check if charts, search bars and field name autocomplete fields are working --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
closes #180689
Summary
This PR lays the necessary foundation to deprecate the indices fields list attribute retrieved and returned by the
api/metrics/source
endpoint and affects all infra pages.Now instead of the Metrics UI and Inventory UI relying on that attribute to build the list of suggestions in their search bars, an adhoc data view will be created from the
metricsAlias
returned by the same endpoint. The data view object contains everything that's needed with the benefit of allowing us to make async requests and cache, provided by Data Views Service.This will allow us to start moving away from
api/metrics/source
to retrieve information critical to the loading of the pages.It's a big PR, and the changes affect mostly the search bars, field name selectors, and charts across infra. Besides, it also contains
<MetricsPageTemplate />
now encapsulates error messages and is only used in Infrastructure pagesSourceProvider
refactor.How to test