-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Stack Monitoring] Logstash migration #113256
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1d52884
Migrate lots of logstash pages
phillipb 17cb4bc
Fix merge
phillipb fd7f43c
prettier
phillipb ba9ffbe
Merge branch 'master' of https://github.com/elastic/kibana into logst…
phillipb d556309
Fix lint
phillipb 4dbe5f2
Merge branch 'master' of https://github.com/elastic/kibana into logst…
phillipb 7d54ed3
Turn off react test
phillipb 7d5b9b9
Merge branch 'master' into logstash-migration
kibanamachine 7405f92
Fix some lint stuff
phillipb 463cf15
Merge branch 'master' of https://github.com/elastic/kibana into logst…
phillipb 5b87458
Merge branch 'logstash-migration' of https://github.com/phillipb/kiba…
phillipb 02c3195
Fix types
phillipb eb68708
Fix lint
phillipb 7e7adc8
Add in version switcher
phillipb ce3e814
Add version switcher
phillipb 13faa4f
Merge branch 'logstash-migration' of https://github.com/phillipb/kiba…
phillipb 2ea390a
turn off react app
phillipb c555bba
Merge branch 'master' of https://github.com/elastic/kibana into logst…
phillipb 18051a8
Fix lint
phillipb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
x-pack/plugins/monitoring/public/application/pages/logstash/advanced.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
| import React, { useContext, useState, useCallback, useMemo } from 'react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { find } from 'lodash'; | ||
| import { | ||
| EuiPage, | ||
| EuiPageBody, | ||
| EuiPanel, | ||
| EuiSpacer, | ||
| EuiPageContent, | ||
| EuiFlexGrid, | ||
| EuiFlexItem, | ||
| } from '@elastic/eui'; | ||
| import { useRouteMatch } from 'react-router-dom'; | ||
| import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; | ||
| import { GlobalStateContext } from '../../global_state_context'; | ||
| import { ComponentProps } from '../../route_init'; | ||
| // @ts-ignore | ||
| import { Listing } from '../../../components/logstash/listing'; | ||
| import { LogstashTemplate } from './logstash_template'; | ||
| // @ts-ignore | ||
| import { DetailStatus } from '../../../components/logstash/detail_status'; | ||
| // @ts-ignore | ||
| import { MonitoringTimeseriesContainer } from '../../../components/chart'; | ||
| import { AlertsCallout } from '../../../alerts/callout'; | ||
| import { useCharts } from '../../hooks/use_charts'; | ||
|
|
||
| export const LogStashNodeAdvancedPage: React.FC<ComponentProps> = ({ clusters }) => { | ||
| const globalState = useContext(GlobalStateContext); | ||
| const match = useRouteMatch<{ uuid: string | undefined }>(); | ||
| const { services } = useKibana<{ data: any }>(); | ||
| const clusterUuid = globalState.cluster_uuid; | ||
| const { zoomInfo, onBrush } = useCharts(); | ||
| const ccs = globalState.ccs; | ||
| const cluster = find(clusters, { | ||
| cluster_uuid: clusterUuid, | ||
| }); | ||
|
|
||
| const [data, setData] = useState({} as any); | ||
|
|
||
| const title = i18n.translate('xpack.monitoring.logstash.node.advanced.routeTitle', { | ||
| defaultMessage: 'Logstash - {nodeName} - Advanced', | ||
| values: { | ||
| nodeName: data.nodeSummary ? data.nodeSummary.name : '', | ||
| }, | ||
| }); | ||
|
|
||
| const pageTitle = i18n.translate('xpack.monitoring.logstash.node.advanced.pageTitle', { | ||
| defaultMessage: 'Logstash node: {nodeName}', | ||
| values: { | ||
| nodeName: data.nodeSummary ? data.nodeSummary.name : '', | ||
| }, | ||
| }); | ||
|
|
||
| const getPageData = useCallback(async () => { | ||
| const bounds = services.data?.query.timefilter.timefilter.getBounds(); | ||
| const url = `../api/monitoring/v1/clusters/${clusterUuid}/logstash/node/${match.params.uuid}`; | ||
| const response = await services.http?.fetch(url, { | ||
| method: 'POST', | ||
| body: JSON.stringify({ | ||
| ccs, | ||
| timeRange: { | ||
| min: bounds.min.toISOString(), | ||
| max: bounds.max.toISOString(), | ||
| }, | ||
| is_advanced: true, | ||
| }), | ||
| }); | ||
|
|
||
| setData(response); | ||
| }, [ | ||
| ccs, | ||
| clusterUuid, | ||
| services.data?.query.timefilter.timefilter, | ||
| services.http, | ||
| match.params.uuid, | ||
| ]); | ||
|
|
||
| const metricsToShow = useMemo(() => { | ||
| if (!data.metrics) return []; | ||
|
|
||
| return [ | ||
| data.metrics.logstash_node_cpu_utilization, | ||
| data.metrics.logstash_queue_events_count, | ||
| data.metrics.logstash_node_cgroup_cpu, | ||
| data.metrics.logstash_pipeline_queue_size, | ||
| data.metrics.logstash_node_cgroup_stats, | ||
| ]; | ||
| }, [data.metrics]); | ||
|
|
||
| return ( | ||
| <LogstashTemplate | ||
| instance={data} | ||
| title={title} | ||
| pageTitle={pageTitle} | ||
| getPageData={getPageData} | ||
| cluster={cluster} | ||
| > | ||
| <EuiPage> | ||
| <EuiPageBody> | ||
| <EuiPanel>{data.nodeSummary && <DetailStatus stats={data.nodeSummary} />}</EuiPanel> | ||
| <EuiSpacer size="m" /> | ||
| <AlertsCallout alerts={{}} /> | ||
| <EuiPageContent> | ||
| <EuiFlexGrid columns={2} gutterSize="s"> | ||
| {metricsToShow.map((metric, index) => ( | ||
| <EuiFlexItem key={index}> | ||
| <MonitoringTimeseriesContainer | ||
| series={metric} | ||
| onBrush={onBrush} | ||
| zoomInfo={zoomInfo} | ||
| {...data} | ||
| /> | ||
| <EuiSpacer /> | ||
| </EuiFlexItem> | ||
| ))} | ||
| </EuiFlexGrid> | ||
| </EuiPageContent> | ||
| </EuiPageBody> | ||
| </EuiPage> | ||
| </LogstashTemplate> | ||
| ); | ||
| }; |
85 changes: 85 additions & 0 deletions
85
x-pack/plugins/monitoring/public/application/pages/logstash/logstash_template.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
| import React from 'react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { PageTemplate } from '../page_template'; | ||
| import { TabMenuItem, PageTemplateProps } from '../page_template'; | ||
|
|
||
| interface LogstashTemplateProps extends PageTemplateProps { | ||
| cluster: any; | ||
| instance?: any; | ||
| pipelineId?: string; | ||
| pipelineVersions?: string[]; | ||
| tabsDisabled?: boolean; | ||
| } | ||
|
|
||
| export const LogstashTemplate: React.FC<LogstashTemplateProps> = ({ | ||
| cluster, | ||
| instance, | ||
| pipelineId, | ||
| pipelineVersions, | ||
| tabsDisabled, | ||
| ...props | ||
| }) => { | ||
| const tabs: TabMenuItem[] = []; | ||
| if (!tabsDisabled) { | ||
| if (!instance && !pipelineId) { | ||
| tabs.push({ | ||
| id: 'overview', | ||
| label: i18n.translate('xpack.monitoring.logstashNavigation.overviewLinkText', { | ||
| defaultMessage: 'Overview', | ||
| }), | ||
| route: '/logstash', | ||
| }); | ||
| tabs.push({ | ||
| id: 'nodes', | ||
| label: i18n.translate('xpack.monitoring.logstashNavigation.nodesLinkText', { | ||
| defaultMessage: 'Nodes', | ||
| }), | ||
| route: '/logstash/nodes', | ||
| }); | ||
| tabs.push({ | ||
| id: 'pipelines', | ||
| label: i18n.translate('xpack.monitoring.logstashNavigation.pipelinesLinkText', { | ||
| defaultMessage: 'Pipelines', | ||
| }), | ||
| route: '/logstash/pipelines', | ||
| }); | ||
| } else if (instance) { | ||
| tabs.push({ | ||
| id: 'overview', | ||
| label: i18n.translate('xpack.monitoring.logstashNavigation.instance.overviewLinkText', { | ||
| defaultMessage: 'Overview', | ||
| }), | ||
| route: `/logstash/node/${instance.nodeSummary?.uuid}`, // IDK if this is right | ||
| }); | ||
| tabs.push({ | ||
| id: 'pipeline', | ||
| label: i18n.translate('xpack.monitoring.logstashNavigation.instance.pipelinesLinkText', { | ||
| defaultMessage: 'Pipelines', | ||
| }), | ||
| route: `/logstash/node/${instance.nodeSummary?.uuid}/pipelines`, // IDK if this is right | ||
| }); | ||
| tabs.push({ | ||
| id: 'advanced', | ||
| label: i18n.translate('xpack.monitoring.logstashNavigation.instance.advancedLinkText', { | ||
| defaultMessage: 'Advanced', | ||
| }), | ||
| route: `/logstash/node/${instance.nodeSummary?.uuid}/advanced`, // IDK if this is right | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| if (pipelineVersions && pipelineVersions.length) { | ||
| // todo add this in: https://github.com/elastic/kibana/blob/4584a8b570402aa07832cf3e5b520e5d2cfa7166/x-pack/plugins/monitoring/public/directives/main/index.js#L36, https://github.com/elastic/kibana/blob/c07a512e4647a40d8e891eb24f5912783b561fba/x-pack/plugins/monitoring/public/directives/main/index.html#L293-L298 | ||
| // tabs.push({ | ||
| // id: 'dropdown-elm', | ||
| // }) | ||
| } | ||
|
|
||
| return <PageTemplate {...props} tabs={tabs} product="logstash" />; | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.