Skip to content

Commit

Permalink
Fix issue with ES node detail status
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Jul 17, 2020
1 parent 28189c2 commit 2987b75
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { NodeDetailStatus } from '../node_detail_status';
import { MonitoringTimeseriesContainer } from '../../chart';
import { FormattedMessage } from '@kbn/i18n/react';

export const AdvancedNode = ({ nodeSummary, metrics, ...props }) => {
export const AdvancedNode = ({ nodeSummary, metrics, alerts, ...props }) => {
const metricsToShow = [
metrics.node_gc,
metrics.node_gc_time,
Expand Down Expand Up @@ -50,7 +50,7 @@ export const AdvancedNode = ({ nodeSummary, metrics, ...props }) => {
</h1>
</EuiScreenReaderOnly>
<EuiPanel>
<NodeDetailStatus stats={nodeSummary} />
<NodeDetailStatus stats={nodeSummary} alerts={alerts} />
</EuiPanel>
<EuiSpacer size="m" />
<EuiPageContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { SummaryStatus } from '../../summary_status';
import { NodeStatusIcon } from '../node';
import { formatMetric } from '../../../lib/format_number';
import { i18n } from '@kbn/i18n';
import { AlertsStatus } from '../../../alerts/status';

export function NodeDetailStatus({ stats, alerts }) {
export function NodeDetailStatus({ stats, alerts = {} }) {
const {
transport_address: transportAddress,
usedHeap,
Expand All @@ -29,8 +30,10 @@ export function NodeDetailStatus({ stats, alerts }) {

const metrics = [
{
label: 'Alerts',
value: <span>{Object.values(alerts).length}</span>,
label: i18n.translate('xpack.monitoring.elasticsearch.nodeDetailStatus.alerts', {
defaultMessage: 'Alerts',
}),
value: <AlertsStatus alerts={alerts} showOnlyCount={true} />,
},
{
label: i18n.translate('xpack.monitoring.elasticsearch.nodeDetailStatus.transportAddress', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import template from './index.html';
import { Legacy } from '../../../../legacy_shims';
import { AdvancedNode } from '../../../../components/elasticsearch/node/advanced';
import { MonitoringViewBaseController } from '../../../base_controller';
import { CODE_PATH_ELASTICSEARCH } from '../../../../../common/constants';
import { CODE_PATH_ELASTICSEARCH, ALERT_CPU_USAGE } from '../../../../../common/constants';

function getPageData($injector) {
const $http = $injector.get('$http');
Expand Down Expand Up @@ -53,12 +53,26 @@ uiRoutes.when('/elasticsearch/nodes/:node/advanced', {
},
controller: class extends MonitoringViewBaseController {
constructor($injector, $scope) {
const $route = $injector.get('$route');
const nodeName = $route.current.params.node;

super({
defaultData: {},
getPageData,
reactNodeId: 'monitoringElasticsearchAdvancedNodeApp',
$scope,
$injector,
alerts: {
shouldFetch: true,
options: {
alertTypeIds: [ALERT_CPU_USAGE],
filters: [
{
nodeUuid: nodeName,
},
],
},
},
});

$scope.$watch(
Expand All @@ -80,6 +94,7 @@ uiRoutes.when('/elasticsearch/nodes/:node/advanced', {
this.renderReact(
<AdvancedNode
nodeSummary={data.nodeSummary}
alerts={this.alerts}
metrics={data.metrics}
onBrush={this.onBrush}
zoomInfo={this.zoomInfo}
Expand Down

0 comments on commit 2987b75

Please sign in to comment.