Fix issue with no logstash monitoring data in the top end of the time series (#61273)

This commit is contained in:
Chris Roberson 2020-03-25 13:35:45 -04:00 committed by GitHub
parent 72406f3d5c
commit 6c8cc4cf74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -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];
}
}

View file

@ -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);
});
});
}