-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] CCR UI #23013
Merged
Merged
[Monitoring] CCR UI #23013
Changes from 10 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
63e5dac
Initial version of CCR monitoring UI
chrisronline 025f248
Adding missing files
chrisronline 09f99e6
Use icons
chrisronline 7a66a00
Use new column header text
chrisronline 00f9706
Update tests
chrisronline f0145ef
Basic of shard detail page
chrisronline 6c25a27
Do these in parallel
chrisronline 42f9bdd
Disable time picker on ccr page
chrisronline b1683f1
Remove summary for now
chrisronline bafc945
Remove unnecessary code here
chrisronline b325eb2
Fix a few things on the shard page
chrisronline 8691dc5
Only send down what we need
chrisronline f0bd7e3
update snapshot
chrisronline 0ca3b45
Handle no ccr_stats documents
chrisronline e9a4051
Ensure we fetch the latest
chrisronline fac343b
Updates
chrisronline 1451a08
Format the time
chrisronline ffd5bf4
Add api integration tests
chrisronline 6b75c0d
Adding pagination and sorting
chrisronline e1181a5
Updated query logic
chrisronline 41aa135
Merge remote-tracking branch 'elastic/master' into monitoring/ccr
chrisronline cadae6b
Change this back
chrisronline 38e4a67
Merge remote-tracking branch 'elastic/master' into monitoring/ccr
chrisronline 6bfb58f
Add specific information about the follower and leader lag ops
chrisronline 195c58a
Update tests
chrisronline a179832
UI updates
chrisronline 183accd
Address PR issues
chrisronline bc4e068
Fix tests
chrisronline 2c75c68
Merge in master
chrisronline ca9cce4
Update shapshots
chrisronline e16515e
Add timestamp
chrisronline 8cd1cbe
Update tests
chrisronline c46b2fc
Add a few snapshot tests
chrisronline 36b8384
Use timezone formatter
chrisronline d22f966
Fix tests
chrisronline d4cf306
Merge remote-tracking branch 'elastic/master' into monitoring/ccr
chrisronline 0248638
Merge remote-tracking branch 'elastic/master' into monitoring/ccr
chrisronline d7b156c
Merge remote-tracking branch 'elastic/master' into monitoring/ccr
chrisronline 0fdc024
Fix aligment of shard table
chrisronline 94f06d9
PR feedback
chrisronline 8f86714
Update snapshots
chrisronline a4184fb
Update snapshot
chrisronline 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
140 changes: 140 additions & 0 deletions
140
x-pack/plugins/monitoring/public/components/elasticsearch/ccr/index.js
This file contains 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,140 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { Component } from 'react'; | ||
import { | ||
EuiBasicTable, | ||
EuiLink, | ||
EuiPage, | ||
EuiPageBody, | ||
EuiPageContent, | ||
EuiPageContentBody, | ||
EuiIcon, | ||
} from '@elastic/eui'; | ||
|
||
export class Ccr extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
itemIdToExpandedRowMap: {}, | ||
}; | ||
} | ||
|
||
toggleShard(index) { | ||
const { data: { shardStatsByFollowerIndex } } = this.props; | ||
|
||
const itemIdToExpandedRowMap = { | ||
...this.state.itemIdToExpandedRowMap | ||
}; | ||
|
||
if (itemIdToExpandedRowMap[index]) { | ||
delete itemIdToExpandedRowMap[index]; | ||
} else { | ||
itemIdToExpandedRowMap[index] = ( | ||
<EuiBasicTable | ||
items={Object.values(shardStatsByFollowerIndex[index])} | ||
columns={[ | ||
{ | ||
field: 'shardId', | ||
name: 'Shard', | ||
render: shardId => { | ||
return ( | ||
<EuiLink href={`#/elasticsearch/ccr/${index}/shard/${shardId}`}> | ||
{shardId} | ||
</EuiLink> | ||
); | ||
} | ||
}, | ||
{ | ||
field: 'follows', | ||
name: 'Follows' | ||
}, | ||
{ | ||
field: 'opsSynced', | ||
name: 'Ops synced' | ||
}, | ||
{ | ||
field: 'syncLagTime', | ||
name: 'Last fetch time' | ||
}, | ||
{ | ||
field: 'syncLagOps', | ||
name: 'Sync Lag (ops)', | ||
}, | ||
{ | ||
field: 'error', | ||
name: 'Error', | ||
} | ||
]} | ||
/> | ||
); | ||
} | ||
this.setState({ itemIdToExpandedRowMap }); | ||
} | ||
|
||
renderTable() { | ||
const { data: { all } } = this.props; | ||
const items = all; | ||
|
||
return ( | ||
<EuiBasicTable | ||
columns={[ | ||
{ | ||
field: 'index', | ||
name: 'Index', | ||
render: (index) => { | ||
const expanded = !!this.state.itemIdToExpandedRowMap[index]; | ||
return ( | ||
<EuiLink onClick={() => this.toggleShard(index)}> | ||
{index} | ||
| ||
{ expanded ? <EuiIcon type="arrowUp" /> : <EuiIcon type="arrowDown" /> } | ||
</EuiLink> | ||
); | ||
} | ||
}, | ||
{ | ||
field: 'follows', | ||
name: 'Follows' | ||
}, | ||
{ | ||
field: 'opsSynced', | ||
name: 'Ops synced' | ||
}, | ||
{ | ||
field: 'syncLagTime', | ||
name: 'Last fetch time' | ||
}, | ||
{ | ||
field: 'syncLagOps', | ||
name: 'Sync Lag (ops)' | ||
}, | ||
{ | ||
field: 'error', | ||
name: 'Error' | ||
} | ||
]} | ||
items={items} | ||
itemId="id" | ||
itemIdToExpandedRowMap={this.state.itemIdToExpandedRowMap} | ||
/> | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<EuiPage> | ||
<EuiPageBody> | ||
<EuiPageContent> | ||
<EuiPageContentBody> | ||
{this.renderTable()} | ||
</EuiPageContentBody> | ||
</EuiPageContent> | ||
</EuiPageBody> | ||
</EuiPage> | ||
); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/index.js
This file contains 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,59 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { Fragment, PureComponent } from 'react'; | ||
import { | ||
EuiPage, | ||
EuiPageBody, | ||
EuiPanel, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiSpacer, | ||
} from '@elastic/eui'; | ||
import { MonitoringTimeseriesContainer } from '../../chart'; | ||
import { Status } from './status'; | ||
|
||
export class CcrShard extends PureComponent { | ||
renderCharts() { | ||
const { metrics } = this.props; | ||
const seriesToShow = [ | ||
[metrics.sync_lag_time], | ||
[metrics.sync_lag_ops] | ||
]; | ||
|
||
const charts = seriesToShow.map((data, index) => ( | ||
<EuiFlexItem style={{ minWidth: '45%' }} key={index}> | ||
<EuiPanel> | ||
<MonitoringTimeseriesContainer | ||
series={data} | ||
/> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
)); | ||
|
||
return ( | ||
<Fragment> | ||
{charts} | ||
</Fragment> | ||
); | ||
} | ||
|
||
render() { | ||
const { stat } = this.props; | ||
|
||
return ( | ||
<EuiPage style={{ backgroundColor: 'white' }}> | ||
<EuiPageBody> | ||
<Status stats={stat}/> | ||
<EuiSpacer size="s"/> | ||
<EuiFlexGroup wrap> | ||
{this.renderCharts()} | ||
</EuiFlexGroup> | ||
</EuiPageBody> | ||
</EuiPage> | ||
); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/status.js
This file contains 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,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { SummaryStatus } from '../../summary_status'; | ||
import { formatMetric } from '../../../lib/format_number'; | ||
|
||
export function Status({ stats }) { | ||
const { | ||
follower_index: followerIndex, | ||
shard_id: shardId, | ||
leader_index: leaderIndex, | ||
operations_received: operationsReceived | ||
} = stats; | ||
|
||
const metrics = [ | ||
{ | ||
label: 'Follower Index', | ||
value: followerIndex, | ||
dataTestSubj: 'followerIndex' | ||
}, | ||
{ | ||
label: 'Shard Id', | ||
value: shardId, | ||
dataTestSubj: 'shardId' | ||
}, | ||
{ | ||
label: 'Leader Index', | ||
value: leaderIndex, | ||
dataTestSubj: 'leaderIndex' | ||
}, | ||
{ | ||
label: 'Total Ops Synced', | ||
value: formatMetric(operationsReceived, 'int_commas'), | ||
dataTestSubj: 'operationsReceived' | ||
}, | ||
]; | ||
|
||
return ( | ||
<SummaryStatus | ||
metrics={metrics} | ||
data-test-subj="ccrDetailStatus" | ||
/> | ||
); | ||
} |
This file contains 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
This file contains 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
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/monitoring/public/views/elasticsearch/ccr/get_page_data.js
This file contains 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,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { ajaxErrorHandlersProvider } from 'plugins/monitoring/lib/ajax_error_handler'; | ||
import { timefilter } from 'ui/timefilter'; | ||
|
||
export function getPageData($injector) { | ||
const $http = $injector.get('$http'); | ||
const globalState = $injector.get('globalState'); | ||
const timeBounds = timefilter.getBounds(); | ||
const url = `../api/monitoring/v1/clusters/${globalState.cluster_uuid}/elasticsearch/ccr`; | ||
|
||
return $http.post(url, { | ||
ccs: globalState.ccs, | ||
timeRange: { | ||
min: timeBounds.min.toISOString(), | ||
max: timeBounds.max.toISOString() | ||
} | ||
}) | ||
.then(response => response.data) | ||
.catch((err) => { | ||
const Private = $injector.get('Private'); | ||
const ajaxErrorHandlers = Private(ajaxErrorHandlersProvider); | ||
return ajaxErrorHandlers(err); | ||
}); | ||
} |
7 changes: 7 additions & 0 deletions
7
x-pack/plugins/monitoring/public/views/elasticsearch/ccr/index.html
This file contains 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,7 @@ | ||
<monitoring-main | ||
product="elasticsearch" | ||
name="ccr" | ||
data-test-subj="elasticsearchCcrListingPage" | ||
> | ||
<div id="elasticsearchCcrReact"></div> | ||
</monitoring-main> |
44 changes: 44 additions & 0 deletions
44
x-pack/plugins/monitoring/public/views/elasticsearch/ccr/index.js
This file contains 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,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import uiRoutes from 'ui/routes'; | ||
import { getPageData } from './get_page_data'; | ||
import template from './index.html'; | ||
import { timefilter } from 'ui/timefilter'; | ||
import { Ccr } from '../../../components/elasticsearch/ccr'; | ||
import { MonitoringViewBaseController } from '../../base_controller'; | ||
|
||
uiRoutes.when('/elasticsearch/ccr', { | ||
template, | ||
resolve: { | ||
pageData: getPageData, | ||
}, | ||
controllerAs: 'elasticsearchCcr', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the convention for abbreviations? In Golang we would use |
||
controller: class ElasticsearchCcrController extends MonitoringViewBaseController { | ||
constructor($injector, $scope) { | ||
super({ | ||
title: 'Elasticsearch - Ccr', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be |
||
reactNodeId: 'elasticsearchCcrReact', | ||
getPageData, | ||
$scope, | ||
$injector | ||
}); | ||
|
||
timefilter.disableTimeRangeSelector(); | ||
|
||
$scope.$watch(() => this.data, data => { | ||
this.renderReact(data); | ||
}); | ||
|
||
this.renderReact = ({ data }) => { | ||
super.renderReact( | ||
<Ccr data={data} /> | ||
); | ||
}; | ||
} | ||
} | ||
}); |
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/monitoring/public/views/elasticsearch/ccr/shard/get_page_data.js
This file contains 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,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { ajaxErrorHandlersProvider } from 'plugins/monitoring/lib/ajax_error_handler'; | ||
import { timefilter } from 'ui/timefilter'; | ||
|
||
export function getPageData($injector) { | ||
const $http = $injector.get('$http'); | ||
const $route = $injector.get('$route'); | ||
const globalState = $injector.get('globalState'); | ||
const timeBounds = timefilter.getBounds(); | ||
const url = `../api/monitoring/v1/clusters/${globalState.cluster_uuid}/elasticsearch/ccr/${$route.current.params.index}/shard/${$route.current.params.shardId}`; // eslint-disable-line max-len | ||
|
||
return $http.post(url, { | ||
ccs: globalState.ccs, | ||
timeRange: { | ||
min: timeBounds.min.toISOString(), | ||
max: timeBounds.max.toISOString() | ||
} | ||
}) | ||
.then(response => response.data) | ||
.catch((err) => { | ||
const Private = $injector.get('Private'); | ||
const ajaxErrorHandlers = Private(ajaxErrorHandlersProvider); | ||
return ajaxErrorHandlers(err); | ||
}); | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
x-pack/plugins/monitoring/public/views/elasticsearch/ccr/shard/index.html
This file contains 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,7 @@ | ||
<monitoring-main | ||
product="elasticsearch" | ||
name="ccr_shard" | ||
data-test-subj="elasticsearchCcrShardPage" | ||
> | ||
<div id="elasticsearchCcrShardReact"></div> | ||
</monitoring-main> |
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.
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.
For the future it would be nice if CCR would only be shown if the ES version that is monitored supports CCR or we have data related to it. We could also then add an info icon on why it is not enabled and tell users about CCR.