diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js b/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js index 5ceb9536be2a..81eca5bbff9c 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js @@ -118,6 +118,9 @@ async function getPaginatedThroughputData(pipelines, req, lsIndexPattern, throug for (const pipeline of pipelines) { if (pipelineAggregationData.id === pipeline.id) { const dataSeries = get(pipelineAggregationData, `metrics.${throughputMetric}.data`, [[]]); + if (dataSeries.length === 0) { + continue; + } pipeline[throughputMetric] = dataSeries.pop()[1]; } } diff --git a/x-pack/test/api_integration/apis/monitoring/logstash/pipelines.js b/x-pack/test/api_integration/apis/monitoring/logstash/pipelines.js index b93f03151f6c..fd427039d29c 100644 --- a/x-pack/test/api_integration/apis/monitoring/logstash/pipelines.js +++ b/x-pack/test/api_integration/apis/monitoring/logstash/pipelines.js @@ -58,5 +58,27 @@ export default function({ getService }) { const ids = [...(await getIds(0)), ...(await getIds(1)), ...(await getIds(2))]; expect(ids.length).to.be(26); }); + + it('should not error out if there is missing data for part of the time series', async () => { + const customTimeRange = { + ...timeRange, + max: '2019-11-04T15:59:38.667Z', + }; + + const customSort = { + ...sort, + field: 'logstash_cluster_pipeline_throughput', + }; + + await supertest + .post('/api/monitoring/v1/clusters/TUjQLdHNTh2SB9Wy0gOtWg/logstash/pipelines') + .set('kbn-xsrf', 'xxx') + .send({ + timeRange: customTimeRange, + pagination: { ...pagination, index: 1 }, + sort: customSort, + }) + .expect(200); + }); }); }