Skip to content
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

[Monitoring] Metricbeat Migration Wizard (last step!!) #45799

Merged
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
bc66425
Enable setup mode UI toggles
chrisronline Aug 6, 2019
3f0c65a
We want to keep the no data page but update the copy
chrisronline Aug 19, 2019
8c7e679
More updated copy
chrisronline Aug 19, 2019
10aeb2b
Remove manual checks for logstash, beats, apm and kibana
chrisronline Aug 19, 2019
3b33637
Hide the setup mode controls on the no data page. There is nothing di…
chrisronline Aug 21, 2019
100da8b
Setup mode test
chrisronline Aug 21, 2019
236b08b
Fix bug with disabling internal collection for ES
chrisronline Sep 4, 2019
fa80d10
First steps towards the redesign of setup mode
chrisronline Sep 6, 2019
cfb67e6
Consolidate UI code, design changes, use constants defined in our plugin
chrisronline Sep 9, 2019
2e72734
Fix tooltips
chrisronline Sep 9, 2019
679ff23
Merge remote-tracking branch 'elastic/master' into monitoring/mb_setu…
chrisronline Sep 9, 2019
da0e658
Design/copy feedback
chrisronline Sep 10, 2019
2241135
Use badge and onClick
chrisronline Sep 10, 2019
faea4c2
More feedback
chrisronline Sep 16, 2019
7bc14c8
Only detect usage on the live cluster
chrisronline Sep 16, 2019
17991ab
Fix existing tests, remove test that will be added in other PR
chrisronline Sep 16, 2019
bfe2b49
Merge in master
chrisronline Sep 16, 2019
af03ab4
Fix failing test
chrisronline Sep 16, 2019
1b75c94
Fix issue with wrong callout showing
chrisronline Sep 17, 2019
cdc25ea
Ensure we check for live nodes if no cluster uuid is provided
chrisronline Sep 17, 2019
207c0c7
We need a custom listing callout for ES
chrisronline Sep 17, 2019
46ef2af
Custom callout for kibana instances
chrisronline Sep 17, 2019
7ba9bf1
More space from the bottom bar
chrisronline Sep 17, 2019
2d83d88
Disable switching if they enabled internal collection
chrisronline Sep 17, 2019
079d44c
Copy updates
chrisronline Sep 17, 2019
7454702
Fix broken tests
chrisronline Sep 17, 2019
6af3a07
Fix more tests
chrisronline Sep 17, 2019
b83a1d4
Fix i18n
chrisronline Sep 18, 2019
7facf47
Update copy
chrisronline Sep 19, 2019
e0b6806
Merge in master
chrisronline Sep 19, 2019
b9c29a8
Fix a couple i18n issues
chrisronline Sep 20, 2019
d86ebba
Fixing a couple of missing scenarios
chrisronline Sep 20, 2019
3f57210
Fix translations
chrisronline Sep 24, 2019
a92d02d
Update snapshots
chrisronline Sep 24, 2019
7bd565c
Merge remote-tracking branch 'elastic/master' into monitoring/mb_setu…
chrisronline Sep 24, 2019
23860df
Merge remote-tracking branch 'elastic/master' into monitoring/mb_setu…
chrisronline Sep 30, 2019
a7dda51
PR feedback
chrisronline Sep 30, 2019
b9cfc26
PR feedback
chrisronline Sep 30, 2019
a82dd8a
We also need totalUniqueInternallyCollectedCount to identify when we …
chrisronline Oct 1, 2019
afa5751
Remove why documentation link until we have the resource available
chrisronline Oct 1, 2019
3c88753
Ensure tabs are properly disabled
chrisronline Oct 1, 2019
cf32128
Address issue with the ES nodes callout not working at times
chrisronline Oct 1, 2019
906c254
Ensure we check if setup mode is enabled
chrisronline Oct 1, 2019
05279cf
Change internal collection to self monitoring, and remove the word 'c…
chrisronline Oct 1, 2019
309acef
Merge in master
chrisronline Oct 1, 2019
82c03e3
Only show Enter setup mode on pages with valid setup mode options
chrisronline Oct 1, 2019
76f3ae2
Copy updates
chrisronline Oct 1, 2019
997de3e
Copy updates
chrisronline Oct 2, 2019
ed27251
Ensure we update the top nav item when we toggle setup mode on or off
chrisronline Oct 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions x-pack/legacy/plugins/monitoring/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@ export const INDEX_PATTERN_FILEBEAT = 'filebeat-*';
export const METRICBEAT_INDEX_NAME_UNIQUE_TOKEN = '-mb-';

// We use this for metricbeat migration to identify specific products that we do not have constants for
export const ELASTICSEARCH_CUSTOM_ID = 'elasticsearch';
export const APM_CUSTOM_ID = 'apm';
export const ELASTICSEARCH_SYSTEM_ID = 'elasticsearch';
export const KIBANA_SYSTEM_ID = 'kibana';
export const BEATS_SYSTEM_ID = 'beats';
export const APM_SYSTEM_ID = 'apm';
export const LOGSTASH_SYSTEM_ID = 'logstash';
/**
* The id of the infra source owned by the monitoring plugin.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,80 +8,111 @@ import React, { Fragment } from 'react';
import moment from 'moment';
import { uniq, get } from 'lodash';
import { EuiMonitoringTable } from '../../table';
import { EuiLink, EuiPage, EuiPageBody, EuiPageContent, EuiSpacer, EuiCallOut } from '@elastic/eui';
import { EuiLink, EuiPage, EuiPageBody, EuiPageContent, EuiSpacer } from '@elastic/eui';
import { Status } from './status';
import { formatMetric } from '../../../lib/format_number';
import { formatTimestampToDuration } from '../../../../common';
import { i18n } from '@kbn/i18n';
import { APM_SYSTEM_ID } from '../../../../common/constants';
import { ListingCallOut } from '../../setup_mode/listing_callout';
import { SetupModeBadge } from '../../setup_mode/badge';

const columns = [
{
name: i18n.translate('xpack.monitoring.apm.instances.nameTitle', {
defaultMessage: 'Name'
}),
field: 'name',
render: (name, instance) => (
<EuiLink
href={`#/apm/instances/${instance.uuid}`}
data-test-subj={`apmLink-${name}`}
>
{name}
</EuiLink>
)
},
{
name: i18n.translate('xpack.monitoring.apm.instances.outputEnabledTitle', {
defaultMessage: 'Output Enabled'
}),
field: 'output'
},
{
name: i18n.translate('xpack.monitoring.apm.instances.totalEventsRateTitle', {
defaultMessage: 'Total Events Rate'
}),
field: 'total_events_rate',
render: value => formatMetric(value, '', '/s')
},
{
name: i18n.translate('xpack.monitoring.apm.instances.bytesSentRateTitle', {
defaultMessage: 'Bytes Sent Rate'
}),
field: 'bytes_sent_rate',
render: value => formatMetric(value, 'byte', '/s')
},
{
name: i18n.translate('xpack.monitoring.apm.instances.outputErrorsTitle', {
defaultMessage: 'Output Errors'
}),
field: 'errors',
render: value => formatMetric(value, '0')
},
{
name: i18n.translate('xpack.monitoring.apm.instances.lastEventTitle', {
defaultMessage: 'Last Event'
}),
field: 'time_of_last_event',
render: value => i18n.translate('xpack.monitoring.apm.instances.lastEventValue', {
defaultMessage: '{timeOfLastEvent} ago',
values: {
timeOfLastEvent: formatTimestampToDuration(+moment(value), 'since')
function getColumns(setupMode) {
return [
{
name: i18n.translate('xpack.monitoring.apm.instances.nameTitle', {
defaultMessage: 'Name'
}),
field: 'name',
render: (name, apm) => {
let setupModeStatus = null;
if (setupMode && setupMode.enabled) {
const list = get(setupMode, 'data.byUuid', {});
const status = list[apm.uuid] || {};
const instance = {
uuid: apm.uuid,
name: apm.name
};

setupModeStatus = (
<div className="monTableCell__setupModeStatus">
<SetupModeBadge
setupMode={setupMode}
status={status}
instance={instance}
productName={APM_SYSTEM_ID}
/>
</div>
);
}

return (
<Fragment>
<EuiLink
href={`#/apm/instances/${apm.uuid}`}
data-test-subj={`apmLink-${name}`}
>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/> ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following? There is a child component so we shouldn't use />

{name}
</EuiLink>
{setupModeStatus}
</Fragment>
);
}
})
},
{
name: i18n.translate('xpack.monitoring.apm.instances.allocatedMemoryTitle', {
defaultMessage: 'Allocated Memory'
}),
field: 'memory',
render: value => formatMetric(value, 'byte')
},
{
name: i18n.translate('xpack.monitoring.apm.instances.versionTitle', {
defaultMessage: 'Version'
}),
field: 'version'
},
];
},
{
name: i18n.translate('xpack.monitoring.apm.instances.outputEnabledTitle', {
defaultMessage: 'Output Enabled'
}),
field: 'output'
},
{
name: i18n.translate('xpack.monitoring.apm.instances.totalEventsRateTitle', {
defaultMessage: 'Total Events Rate'
}),
field: 'total_events_rate',
render: value => formatMetric(value, '', '/s')
},
{
name: i18n.translate('xpack.monitoring.apm.instances.bytesSentRateTitle', {
defaultMessage: 'Bytes Sent Rate'
}),
field: 'bytes_sent_rate',
render: value => formatMetric(value, 'byte', '/s')
},
{
name: i18n.translate('xpack.monitoring.apm.instances.outputErrorsTitle', {
defaultMessage: 'Output Errors'
}),
field: 'errors',
render: value => formatMetric(value, '0')
},
{
name: i18n.translate('xpack.monitoring.apm.instances.lastEventTitle', {
defaultMessage: 'Last Event'
}),
field: 'time_of_last_event',
render: value => i18n.translate('xpack.monitoring.apm.instances.lastEventValue', {
defaultMessage: '{timeOfLastEvent} ago',
values: {
timeOfLastEvent: formatTimestampToDuration(+moment(value), 'since')
}
})
},
{
name: i18n.translate('xpack.monitoring.apm.instances.allocatedMemoryTitle', {
defaultMessage: 'Allocated Memory'
}),
field: 'memory',
render: value => formatMetric(value, 'byte')
},
{
name: i18n.translate('xpack.monitoring.apm.instances.versionTitle', {
defaultMessage: 'Version'
}),
field: 'version'
},
];
}

export function ApmServerInstances({ apms, setupMode }) {
const {
Expand All @@ -91,26 +122,14 @@ export function ApmServerInstances({ apms, setupMode }) {
data,
} = apms;

let detectedInstanceMessage = null;
if (setupMode.enabled && setupMode.data && get(setupMode.data, 'detected.mightExist')) {
detectedInstanceMessage = (
<Fragment>
<EuiCallOut
title={i18n.translate('xpack.monitoring.apm.instances.metricbeatMigration.detectedInstanceTitle', {
defaultMessage: 'APM server detected',
})}
color="warning"
iconType="help"
>
<p>
{i18n.translate('xpack.monitoring.apm.instances.metricbeatMigration.detectedInstanceDescription', {
defaultMessage: `Based on your indices, we think you might have an APM server. Click the 'Setup monitoring'
button below to start monitoring this APM server.`
})}
</p>
</EuiCallOut>
<EuiSpacer size="m"/>
</Fragment>
let setupModeCallout = null;
if (setupMode.data) {
setupModeCallout = (
<ListingCallOut
setupModeData={setupMode.data}
useNodeIdentifier={false}
productName={APM_SYSTEM_ID}
/>
);
}

Expand All @@ -124,19 +143,15 @@ export function ApmServerInstances({ apms, setupMode }) {
<EuiPageContent>
<Status stats={data.stats} />
<EuiSpacer size="m"/>
{detectedInstanceMessage}
{setupModeCallout}
<EuiMonitoringTable
className="apmInstancesTable"
rows={data.apms}
columns={columns}
columns={getColumns(setupMode)}
sorting={sorting}
pagination={pagination}
setupMode={setupMode}
uuidField="uuid"
nameField="name"
setupNewButtonLabel={i18n.translate('xpack.monitoring.apm.metricbeatMigration.setupNewButtonLabel', {
defaultMessage: 'Setup monitoring for new APM server'
})}
productName={APM_SYSTEM_ID}
search={{
box: {
incremental: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,64 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { PureComponent, Fragment } from 'react';
import React, { PureComponent } from 'react';
import { uniq, get } from 'lodash';
import { EuiPage, EuiPageBody, EuiPageContent, EuiSpacer, EuiLink, EuiCallOut } from '@elastic/eui';
import { EuiPage, EuiPageBody, EuiPageContent, EuiSpacer, EuiLink } from '@elastic/eui';
import { Stats } from 'plugins/monitoring/components/beats';
import { formatMetric } from 'plugins/monitoring/lib/format_number';
import { EuiMonitoringTable } from 'plugins/monitoring/components/table';
import { i18n } from '@kbn/i18n';
import { BEATS_SYSTEM_ID } from '../../../../common/constants';
import { ListingCallOut } from '../../setup_mode/listing_callout';
import { SetupModeBadge } from '../../setup_mode/badge';

export class Listing extends PureComponent {
getColumns() {
const { kbnUrl, scope } = this.props.angular;
const setupMode = this.props.setupMode;

return [
{
name: i18n.translate('xpack.monitoring.beats.instances.nameTitle', { defaultMessage: 'Name' }),
field: 'name',
render: (name, beat) => (
<EuiLink
onClick={() => {
scope.$evalAsync(() => {
kbnUrl.changePath(`/beats/beat/${beat.uuid}`);
});
}}
data-test-subj={`beatLink-${name}`}
>
{name}
</EuiLink>
)
render: (name, beat) => {
let setupModeStatus = null;
if (setupMode && setupMode.enabled) {
const list = get(setupMode, 'data.byUuid', {});
const status = list[beat.uuid] || {};
const instance = {
uuid: beat.uuid,
name: beat.name
};

setupModeStatus = (
<div className="monTableCell__setupModeStatus">
<SetupModeBadge
setupMode={setupMode}
status={status}
instance={instance}
productName={BEATS_SYSTEM_ID}
/>
</div>
);
}

return (
<div>
<EuiLink
onClick={() => {
scope.$evalAsync(() => {
kbnUrl.changePath(`/beats/beat/${beat.uuid}`);
});
}}
data-test-subj={`beatLink-${name}`}
>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/> ?

{name}
</EuiLink>
{setupModeStatus}
</div>
);
}
},
{
name: i18n.translate('xpack.monitoring.beats.instances.typeTitle', { defaultMessage: 'Type' }),
Expand Down Expand Up @@ -78,26 +108,14 @@ export class Listing extends PureComponent {
setupMode
} = this.props;

let detectedInstanceMessage = null;
if (setupMode.enabled && setupMode.data && get(setupMode.data, 'detected.mightExist')) {
detectedInstanceMessage = (
<Fragment>
<EuiCallOut
title={i18n.translate('xpack.monitoring.beats.instances.metricbeatMigration.detectedInstanceTitle', {
defaultMessage: 'Beats instance detected',
})}
color="warning"
iconType="help"
>
<p>
{i18n.translate('xpack.monitoring.beats.instances.metricbeatMigration.detectedInstanceDescription', {
defaultMessage: `Based on your indices, we think you might have a beats instance. Click the 'Setup monitoring'
button below to start monitoring this instance.`
})}
</p>
</EuiCallOut>
<EuiSpacer size="m"/>
</Fragment>
let setupModeCallOut = null;
if (setupMode.enabled && setupMode.data) {
setupModeCallOut = (
<ListingCallOut
setupModeData={setupMode.data}
useNodeIdentifier={false}
productName={BEATS_SYSTEM_ID}
/>
);
}

Expand All @@ -115,16 +133,12 @@ export class Listing extends PureComponent {
<EuiPageContent>
<Stats stats={stats} />
<EuiSpacer size="m"/>
{detectedInstanceMessage}
{setupModeCallOut}
<EuiMonitoringTable
className="beatsTable"
rows={data}
setupMode={setupMode}
uuidField="uuid"
nameField="name"
setupNewButtonLabel={i18n.translate('xpack.monitoring.beats.metricbeatMigration.setupNewButtonLabel', {
defaultMessage: 'Setup monitoring for new Beats instance'
})}
productName={BEATS_SYSTEM_ID}
columns={this.getColumns()}
sorting={sorting}
pagination={pagination}
Expand Down
Loading