diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr/__snapshots__/ccr.test.js.snap b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr/__snapshots__/ccr.test.js.snap index 80d38edee404cf..eafc462a416f6b 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr/__snapshots__/ccr.test.js.snap +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr/__snapshots__/ccr.test.js.snap @@ -27,8 +27,8 @@ exports[`Ccr that it renders normally 1`] = ` "sortable": true, }, Object { - "field": "opsSynced", - "name": "Ops synced", + "field": "syncLagOps", + "name": "Sync Lag (ops)", "sortable": true, }, Object { @@ -38,8 +38,8 @@ exports[`Ccr that it renders normally 1`] = ` "sortable": true, }, Object { - "field": "syncLagOps", - "name": "Sync Lag (ops)", + "field": "opsSynced", + "name": "Ops synced", "sortable": true, }, Object { diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr/ccr.js b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr/ccr.js index f57ba2caec3806..f05496d9adeb77 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr/ccr.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr/ccr.js @@ -66,15 +66,6 @@ export class Ccr extends Component { { render: () => null }, - { - field: 'opsSynced', - name: 'Ops synced' - }, - { - field: 'syncLagTime', - name: 'Last fetch time', - render: syncLagTime => {toSeconds(syncLagTime)} - }, { field: 'syncLagOps', name: 'Sync Lag (ops)', @@ -97,6 +88,15 @@ export class Ccr extends Component { ) }, + { + field: 'syncLagTime', + name: 'Last fetch time', + render: syncLagTime => {toSeconds(syncLagTime)} + }, + { + field: 'opsSynced', + name: 'Ops synced' + }, { field: 'error', name: 'Error', @@ -160,9 +160,9 @@ export class Ccr extends Component { name: 'Follows' }, { - field: 'opsSynced', + field: 'syncLagOps', sortable: true, - name: 'Ops synced' + name: 'Sync Lag (ops)', }, { field: 'syncLagTime', @@ -171,9 +171,9 @@ export class Ccr extends Component { render: syncLagTime => {toSeconds(syncLagTime)} }, { - field: 'syncLagOps', + field: 'opsSynced', sortable: true, - name: 'Sync Lag (ops)', + name: 'Ops synced' }, { field: 'error', diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.js b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.js index 8f34ca07320b98..83b1e2797a248f 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.js @@ -27,8 +27,8 @@ export class CcrShard extends PureComponent { renderCharts() { const { metrics } = this.props; const seriesToShow = [ - metrics.ccr_sync_lag_time, - metrics.ccr_sync_lag_ops + metrics.ccr_sync_lag_ops, + metrics.ccr_sync_lag_time ]; const charts = seriesToShow.map((data, index) => ( diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.js b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.js index c2481d71acee87..9c907dacc6cbf9 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.js @@ -37,17 +37,6 @@ function buildRequest(req, config, esIndexPattern) { field: 'ccr_stats.number_of_operations_indexed' } }, - - last_fetch_time_max: { - max: { - field: 'ccr_stats.time_since_last_fetch_millis' - } - }, - last_fetch_time_min: { - min: { - field: 'ccr_stats.time_since_last_fetch_millis' - } - }, lag_ops_leader_max: { max: { field: 'ccr_stats.leader_max_seq_no' @@ -79,7 +68,6 @@ function buildRequest(req, config, esIndexPattern) { } }, - last_fetch_time: getBucketScript('last_fetch_time_max', 'last_fetch_time_min'), ops_synced: getBucketScript('ops_synced_max', 'ops_synced_min'), lag_ops_leader: getBucketScript('lag_ops_leader_max', 'lag_ops_leader_min'), lag_ops_global: getBucketScript('lag_ops_global_max', 'lag_ops_global_min'), @@ -96,10 +84,10 @@ function buildRequest(req, config, esIndexPattern) { 'hits.hits.inner_hits.by_shard.hits.hits._source.ccr_stats.fetch_exceptions', 'hits.hits.inner_hits.by_shard.hits.hits._source.ccr_stats.follower_index', 'hits.hits.inner_hits.by_shard.hits.hits._source.ccr_stats.shard_id', + 'hits.hits.inner_hits.by_shard.hits.hits._source.ccr_stats.time_since_last_fetch_millis', 'aggregations.by_follower_index.buckets.key', 'aggregations.by_follower_index.buckets.leader_index.buckets.key', 'aggregations.by_follower_index.buckets.by_shard_id.buckets.key', - 'aggregations.by_follower_index.buckets.by_shard_id.buckets.last_fetch_time.value', 'aggregations.by_follower_index.buckets.by_shard_id.buckets.ops_synced.value', 'aggregations.by_follower_index.buckets.by_shard_id.buckets.lag_ops.value', 'aggregations.by_follower_index.buckets.by_shard_id.buckets.leader_lag_ops.value', @@ -231,7 +219,7 @@ export function ccrRoute(server) { shardId: shardBucket.key, error: fullStat.fetch_exceptions.length ? fullStat.fetch_exceptions[0].exception.type : null, opsSynced: get(shardBucket, 'ops_synced.value'), - syncLagTime: get(shardBucket, 'last_fetch_time.value'), + syncLagTime: fullStat.time_since_last_fetch_millis, syncLagOps: get(shardBucket, 'lag_ops.value'), syncLagOpsLeader: get(shardBucket, 'leader_lag_ops.value'), syncLagOpsFollower: get(shardBucket, 'follower_lag_ops.value'), diff --git a/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/ccr.json b/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/ccr.json index 6ac135c8bc8583..c72504d3b0f889 100644 --- a/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/ccr.json +++ b/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/ccr.json @@ -7,7 +7,7 @@ "shardId": 0, "error": null, "opsSynced": 52, - "syncLagTime": 59881, + "syncLagTime": 4900, "syncLagOps": 0, "syncLagOpsLeader": 0, "syncLagOpsFollower": 0 @@ -15,7 +15,7 @@ "shardId": 1, "error": null, "opsSynced": 47, - "syncLagTime": 59959, + "syncLagTime": 9919, "syncLagOps": 0, "syncLagOpsLeader": 0, "syncLagOpsFollower": 0 @@ -23,7 +23,7 @@ "shardId": 2, "error": null, "opsSynced": 51, - "syncLagTime": 55229, + "syncLagTime": 14929, "syncLagOps": 0, "syncLagOpsLeader": 0, "syncLagOpsFollower": 0 @@ -31,7 +31,7 @@ "shardId": 3, "error": null, "opsSynced": 50, - "syncLagTime": 50483, + "syncLagTime": 39933, "syncLagOps": 0, "syncLagOpsLeader": 0, "syncLagOpsFollower": 0 @@ -39,13 +39,13 @@ "shardId": 4, "error": null, "opsSynced": 55, - "syncLagTime": 55554, + "syncLagTime": 49923, "syncLagOps": 0, "syncLagOpsLeader": 0, "syncLagOpsFollower": 0 }], "opsSynced": 255, - "syncLagTime": 59959, + "syncLagTime": 49923, "syncLagOps": 0 }, { "id": "follower", @@ -55,7 +55,7 @@ "shardId": 0, "error": null, "opsSynced": 85, - "syncLagTime": 45513, + "syncLagTime": 19886, "syncLagOps": 0, "syncLagOpsLeader": 0, "syncLagOpsFollower": 0 @@ -63,7 +63,7 @@ "shardId": 1, "error": null, "opsSynced": 94, - "syncLagTime": 55205, + "syncLagTime": 4901, "syncLagOps": 0, "syncLagOpsLeader": 0, "syncLagOpsFollower": 0 @@ -71,13 +71,13 @@ "shardId": 2, "error": null, "opsSynced": 76, - "syncLagTime": 50003, + "syncLagTime": 14899, "syncLagOps": 0, "syncLagOpsLeader": 0, "syncLagOpsFollower": 0 }], "opsSynced": 255, - "syncLagTime": 55205, + "syncLagTime": 19886, "syncLagOps": 0 }] }