Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Sep 30, 2020
1 parent 2679131 commit f4c9b67
Show file tree
Hide file tree
Showing 36 changed files with 189 additions and 107 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/monitoring/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const ALERT_NODES_CHANGED = `${ALERT_PREFIX}alert_nodes_changed`;
export const ALERT_ELASTICSEARCH_VERSION_MISMATCH = `${ALERT_PREFIX}alert_elasticsearch_version_mismatch`;
export const ALERT_KIBANA_VERSION_MISMATCH = `${ALERT_PREFIX}alert_kibana_version_mismatch`;
export const ALERT_LOGSTASH_VERSION_MISMATCH = `${ALERT_PREFIX}alert_logstash_version_mismatch`;
export const ALERT_MISSING_DATA = `${ALERT_PREFIX}alert_missing_data`;
export const ALERT_MISSING_MONITORING_DATA = `${ALERT_PREFIX}alert_missing_monitoring_data`;

/**
* A listing of all alert types
Expand All @@ -250,7 +250,7 @@ export const ALERTS = [
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
ALERT_KIBANA_VERSION_MISMATCH,
ALERT_LOGSTASH_VERSION_MISMATCH,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { createMissingDataAlertType } from './missing_data_alert';
export { createMissingMonitoringDataAlertType } from './missing_monitoring_data_alert';
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import React from 'react';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
import { validate } from './validation';
import { ALERT_MISSING_DATA } from '../../../common/constants';
import { ALERT_MISSING_MONITORING_DATA } from '../../../common/constants';
import { Expression } from './expression';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { MissingDataAlert } from '../../../server/alerts';
import { MissingMonitoringDataAlert } from '../../../server/alerts';

export function createMissingDataAlertType(): AlertTypeModel {
const alert = new MissingDataAlert();
export function createMissingMonitoringDataAlertType(): AlertTypeModel {
const alert = new MissingMonitoringDataAlert();
return {
id: ALERT_MISSING_DATA,
id: ALERT_MISSING_MONITORING_DATA,
name: alert.label,
iconClass: 'bell',
alertParamsExpression: (props: any) => (
<Expression {...props} paramDetails={MissingDataAlert.paramDetails} />
<Expression {...props} paramDetails={MissingMonitoringDataAlert.paramDetails} />
),
validate,
defaultActionMessage: '{{context.internalFullMessage}}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { formatTimestampToDuration } from '../../../../common';
import {
CALCULATE_DURATION_SINCE,
APM_SYSTEM_ID,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
} from '../../../../common/constants';
import { SetupModeTooltip } from '../../setup_mode/tooltip';
import { getSafeForExternalLink } from '../../../lib/get_safe_for_external_link';
Expand All @@ -36,7 +36,7 @@ import { SetupModeFeature } from '../../../../common/enums';
import { shouldShowAlertBadge } from '../../../alerts/lib/should_show_alert_badge';
import { AlertsBadge } from '../../../alerts/badge';

const SERVERS_PANEL_ALERTS = [ALERT_MISSING_DATA];
const SERVERS_PANEL_ALERTS = [ALERT_MISSING_MONITORING_DATA];

export function ApmPanel(props) {
const { setupMode, alerts } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import { ClusterItemContainer, DisabledIfNoDataAndInSetupModeLink } from './help
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { SetupModeTooltip } from '../../setup_mode/tooltip';
import { ALERT_MISSING_DATA, BEATS_SYSTEM_ID } from '../../../../common/constants';
import { ALERT_MISSING_MONITORING_DATA, BEATS_SYSTEM_ID } from '../../../../common/constants';
import { getSafeForExternalLink } from '../../../lib/get_safe_for_external_link';
import { isSetupModeFeatureEnabled } from '../../../lib/setup_mode';
import { SetupModeFeature } from '../../../../common/enums';
import { shouldShowAlertBadge } from '../../../alerts/lib/should_show_alert_badge';
import { AlertsBadge } from '../../../alerts/badge';

const BEATS_PANEL_ALERTS = [ALERT_MISSING_DATA];
const BEATS_PANEL_ALERTS = [ALERT_MISSING_MONITORING_DATA];

export function BeatsPanel(props) {
const { setupMode, alerts } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
ALERT_DISK_USAGE,
ALERT_NODES_CHANGED,
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
} from '../../../../common/constants';
import { AlertsBadge } from '../../../alerts/badge';
import { shouldShowAlertBadge } from '../../../alerts/lib/should_show_alert_badge';
Expand Down Expand Up @@ -162,7 +162,7 @@ const NODES_PANEL_ALERTS = [
ALERT_DISK_USAGE,
ALERT_NODES_CHANGED,
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
];

export function ElasticsearchPanel(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ApmPanel } from './apm_panel';
import { FormattedMessage } from '@kbn/i18n/react';
import {
STANDALONE_CLUSTER_CLUSTER_UUID,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
ELASTICSEARCH_SYSTEM_ID,
KIBANA_SYSTEM_ID,
LOGSTASH_SYSTEM_ID,
Expand Down Expand Up @@ -47,7 +47,7 @@ export function Overview(props) {
setupMode={props.setupMode}
showLicenseExpiration={props.showLicenseExpiration}
alerts={filterAlertStates(props.alerts, (type, { state }) => {
if (type === ALERT_MISSING_DATA) {
if (type === ALERT_MISSING_MONITORING_DATA) {
return state.stackProduct === ELASTICSEARCH_SYSTEM_ID;
}
return true;
Expand All @@ -57,7 +57,7 @@ export function Overview(props) {
{...props.cluster.kibana}
setupMode={props.setupMode}
alerts={filterAlertStates(props.alerts, (type, { state }) => {
if (type === ALERT_MISSING_DATA) {
if (type === ALERT_MISSING_MONITORING_DATA) {
return state.stackProduct === KIBANA_SYSTEM_ID;
}
return true;
Expand All @@ -70,7 +70,7 @@ export function Overview(props) {
{...props.cluster.logstash}
setupMode={props.setupMode}
alerts={filterAlertStates(props.alerts, (type, { state }) => {
if (type === ALERT_MISSING_DATA) {
if (type === ALERT_MISSING_MONITORING_DATA) {
return state.stackProduct === LOGSTASH_SYSTEM_ID;
}
return true;
Expand All @@ -81,7 +81,7 @@ export function Overview(props) {
{...props.cluster.beats}
setupMode={props.setupMode}
alerts={filterAlertStates(props.alerts, (type, { state }) => {
if (type === ALERT_MISSING_DATA) {
if (type === ALERT_MISSING_MONITORING_DATA) {
return state.stackProduct === BEATS_SYSTEM_ID;
}
return true;
Expand All @@ -92,7 +92,7 @@ export function Overview(props) {
{...props.cluster.apm}
setupMode={props.setupMode}
alerts={filterAlertStates(props.alerts, (type, { state }) => {
if (type === ALERT_MISSING_DATA) {
if (type === ALERT_MISSING_MONITORING_DATA) {
return state.stackProduct === APM_SYSTEM_ID;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ import { SetupModeTooltip } from '../../setup_mode/tooltip';
import {
KIBANA_SYSTEM_ID,
ALERT_KIBANA_VERSION_MISMATCH,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
} from '../../../../common/constants';
import { getSafeForExternalLink } from '../../../lib/get_safe_for_external_link';
import { AlertsBadge } from '../../../alerts/badge';
import { shouldShowAlertBadge } from '../../../alerts/lib/should_show_alert_badge';
import { isSetupModeFeatureEnabled } from '../../../lib/setup_mode';
import { SetupModeFeature } from '../../../../common/enums';

const INSTANCES_PANEL_ALERTS = [ALERT_KIBANA_VERSION_MISMATCH, ALERT_MISSING_DATA];
const INSTANCES_PANEL_ALERTS = [ALERT_KIBANA_VERSION_MISMATCH, ALERT_MISSING_MONITORING_DATA];

export function KibanaPanel(props) {
const setupMode = props.setupMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
LOGSTASH,
LOGSTASH_SYSTEM_ID,
ALERT_LOGSTASH_VERSION_MISMATCH,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
} from '../../../../common/constants';

import {
Expand All @@ -41,7 +41,7 @@ import { shouldShowAlertBadge } from '../../../alerts/lib/should_show_alert_badg
import { isSetupModeFeatureEnabled } from '../../../lib/setup_mode';
import { SetupModeFeature } from '../../../../common/enums';

const NODES_PANEL_ALERTS = [ALERT_LOGSTASH_VERSION_MISMATCH, ALERT_MISSING_DATA];
const NODES_PANEL_ALERTS = [ALERT_LOGSTASH_VERSION_MISMATCH, ALERT_MISSING_MONITORING_DATA];

export function LogstashPanel(props) {
const { setupMode } = props;
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/monitoring/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { MonitoringStartPluginDependencies, MonitoringConfig } from './types';
import { TriggersAndActionsUIPublicPluginSetup } from '../../triggers_actions_ui/public';
import { createCpuUsageAlertType } from './alerts/cpu_usage_alert';
import { createMissingDataAlertType } from './alerts/missing_data_alert';
import { createMissingMonitoringDataAlertType } from './alerts/missing_monitoring_data_alert';
import { createLegacyAlertTypes } from './alerts/legacy_alert';
import { createDiskUsageAlertType } from './alerts/disk_usage_alert';

Expand Down Expand Up @@ -73,7 +73,7 @@ export class MonitoringPlugin
}

plugins.triggers_actions_ui.alertTypeRegistry.register(createCpuUsageAlertType());
plugins.triggers_actions_ui.alertTypeRegistry.register(createMissingDataAlertType());
plugins.triggers_actions_ui.alertTypeRegistry.register(createMissingMonitoringDataAlertType());
plugins.triggers_actions_ui.alertTypeRegistry.register(createDiskUsageAlertType());
const legacyAlertTypes = createLegacyAlertTypes();
for (const legacyAlertType of legacyAlertTypes) {
Expand Down
8 changes: 6 additions & 2 deletions x-pack/plugins/monitoring/public/views/apm/instance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import { routeInitProvider } from '../../../lib/route_init';
import template from './index.html';
import { MonitoringViewBaseController } from '../../base_controller';
import { ApmServerInstance } from '../../../components/apm/instance';
import { CODE_PATH_APM, ALERT_MISSING_DATA, APM_SYSTEM_ID } from '../../../../common/constants';
import {
CODE_PATH_APM,
ALERT_MISSING_MONITORING_DATA,
APM_SYSTEM_ID,
} from '../../../../common/constants';

uiRoutes.when('/apm/instances/:uuid', {
template,
Expand Down Expand Up @@ -53,7 +57,7 @@ uiRoutes.when('/apm/instances/:uuid', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_MISSING_DATA],
alertTypeIds: [ALERT_MISSING_MONITORING_DATA],
filters: [
{
stackProduct: APM_SYSTEM_ID,
Expand Down
8 changes: 6 additions & 2 deletions x-pack/plugins/monitoring/public/views/apm/instances/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import template from './index.html';
import { ApmServerInstances } from '../../../components/apm/instances';
import { MonitoringViewBaseEuiTableController } from '../..';
import { SetupModeRenderer } from '../../../components/renderers';
import { APM_SYSTEM_ID, CODE_PATH_APM, ALERT_MISSING_DATA } from '../../../../common/constants';
import {
APM_SYSTEM_ID,
CODE_PATH_APM,
ALERT_MISSING_MONITORING_DATA,
} from '../../../../common/constants';

uiRoutes.when('/apm/instances', {
template,
Expand Down Expand Up @@ -50,7 +54,7 @@ uiRoutes.when('/apm/instances', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_MISSING_DATA],
alertTypeIds: [ALERT_MISSING_MONITORING_DATA],
filters: [
{
stackProduct: APM_SYSTEM_ID,
Expand Down
8 changes: 6 additions & 2 deletions x-pack/plugins/monitoring/public/views/apm/overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import { routeInitProvider } from '../../../lib/route_init';
import template from './index.html';
import { MonitoringViewBaseController } from '../../base_controller';
import { ApmOverview } from '../../../components/apm/overview';
import { CODE_PATH_APM, ALERT_MISSING_DATA, APM_SYSTEM_ID } from '../../../../common/constants';
import {
CODE_PATH_APM,
ALERT_MISSING_MONITORING_DATA,
APM_SYSTEM_ID,
} from '../../../../common/constants';

uiRoutes.when('/apm', {
template,
Expand Down Expand Up @@ -45,7 +49,7 @@ uiRoutes.when('/apm', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_MISSING_DATA],
alertTypeIds: [ALERT_MISSING_MONITORING_DATA],
filters: [
{
stackProduct: APM_SYSTEM_ID,
Expand Down
8 changes: 6 additions & 2 deletions x-pack/plugins/monitoring/public/views/beats/beat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import { routeInitProvider } from '../../../lib/route_init';
import { MonitoringViewBaseController } from '../../';
import { getPageData } from './get_page_data';
import template from './index.html';
import { CODE_PATH_BEATS, ALERT_MISSING_DATA, BEATS_SYSTEM_ID } from '../../../../common/constants';
import {
CODE_PATH_BEATS,
ALERT_MISSING_MONITORING_DATA,
BEATS_SYSTEM_ID,
} from '../../../../common/constants';
import { Beat } from '../../../components/beats/beat';

uiRoutes.when('/beats/beat/:beatUuid', {
Expand Down Expand Up @@ -55,7 +59,7 @@ uiRoutes.when('/beats/beat/:beatUuid', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_MISSING_DATA],
alertTypeIds: [ALERT_MISSING_MONITORING_DATA],
filters: [
{
stackProduct: BEATS_SYSTEM_ID,
Expand Down
8 changes: 6 additions & 2 deletions x-pack/plugins/monitoring/public/views/beats/listing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import template from './index.html';
import React, { Fragment } from 'react';
import { Listing } from '../../../components/beats/listing/listing';
import { SetupModeRenderer } from '../../../components/renderers';
import { CODE_PATH_BEATS, BEATS_SYSTEM_ID, ALERT_MISSING_DATA } from '../../../../common/constants';
import {
CODE_PATH_BEATS,
BEATS_SYSTEM_ID,
ALERT_MISSING_MONITORING_DATA,
} from '../../../../common/constants';

uiRoutes.when('/beats/beats', {
template,
Expand Down Expand Up @@ -49,7 +53,7 @@ uiRoutes.when('/beats/beats', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_MISSING_DATA],
alertTypeIds: [ALERT_MISSING_MONITORING_DATA],
filters: [
{
stackProduct: BEATS_SYSTEM_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import { routeInitProvider } from '../../../lib/route_init';
import { MonitoringViewBaseController } from '../../';
import { getPageData } from './get_page_data';
import template from './index.html';
import { CODE_PATH_BEATS, ALERT_MISSING_DATA, BEATS_SYSTEM_ID } from '../../../../common/constants';
import {
CODE_PATH_BEATS,
ALERT_MISSING_MONITORING_DATA,
BEATS_SYSTEM_ID,
} from '../../../../common/constants';
import { BeatsOverview } from '../../../components/beats/overview';

uiRoutes.when('/beats', {
Expand Down Expand Up @@ -47,7 +51,7 @@ uiRoutes.when('/beats', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_MISSING_DATA],
alertTypeIds: [ALERT_MISSING_MONITORING_DATA],
filters: [
{
stackProduct: BEATS_SYSTEM_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { MonitoringViewBaseController } from '../../../base_controller';
import {
CODE_PATH_ELASTICSEARCH,
ALERT_CPU_USAGE,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
ALERT_DISK_USAGE,
} from '../../../../../common/constants';

Expand Down Expand Up @@ -72,7 +72,7 @@ uiRoutes.when('/elasticsearch/nodes/:node/advanced', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_CPU_USAGE, ALERT_DISK_USAGE, ALERT_MISSING_DATA],
alertTypeIds: [ALERT_CPU_USAGE, ALERT_DISK_USAGE, ALERT_MISSING_MONITORING_DATA],
filters: [
{
nodeUuid: nodeName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MonitoringViewBaseController } from '../../base_controller';
import {
CODE_PATH_ELASTICSEARCH,
ALERT_CPU_USAGE,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
ALERT_DISK_USAGE,
} from '../../../../common/constants';

Expand Down Expand Up @@ -56,7 +56,7 @@ uiRoutes.when('/elasticsearch/nodes/:node', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_CPU_USAGE, ALERT_DISK_USAGE, ALERT_MISSING_DATA],
alertTypeIds: [ALERT_CPU_USAGE, ALERT_DISK_USAGE, ALERT_MISSING_MONITORING_DATA],
filters: [
{
nodeUuid: nodeName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
ELASTICSEARCH_SYSTEM_ID,
CODE_PATH_ELASTICSEARCH,
ALERT_CPU_USAGE,
ALERT_MISSING_DATA,
ALERT_MISSING_MONITORING_DATA,
ALERT_DISK_USAGE,
} from '../../../../common/constants';

Expand Down Expand Up @@ -88,7 +88,7 @@ uiRoutes.when('/elasticsearch/nodes', {
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_CPU_USAGE, ALERT_DISK_USAGE, ALERT_MISSING_DATA],
alertTypeIds: [ALERT_CPU_USAGE, ALERT_DISK_USAGE, ALERT_MISSING_MONITORING_DATA],
filters: [
{
stackProduct: ELASTICSEARCH_SYSTEM_ID,
Expand Down
Loading

0 comments on commit f4c9b67

Please sign in to comment.