[Monitoring] Remove kibana_stats.requests.status_codes
from bulk uploader (#20855)
* Remove `status_codes` from bulk uploader * Remove more references to `status_codes`
This commit is contained in:
parent
6132cd92cc
commit
ade24f2104
9 changed files with 3 additions and 25 deletions
|
@ -43,7 +43,6 @@ export class Metrics {
|
||||||
},
|
},
|
||||||
response_times: {},
|
response_times: {},
|
||||||
requests: {
|
requests: {
|
||||||
status_codes: {}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,9 +131,6 @@ describe('Metrics', function () {
|
||||||
},
|
},
|
||||||
'requests': {
|
'requests': {
|
||||||
'disconnects': 0,
|
'disconnects': 0,
|
||||||
'status_codes': {
|
|
||||||
'200': 22
|
|
||||||
},
|
|
||||||
'total': 22
|
'total': 22
|
||||||
},
|
},
|
||||||
'response_times': {
|
'response_times': {
|
||||||
|
@ -159,7 +156,7 @@ describe('Metrics', function () {
|
||||||
memory: { free_in_bytes: 12, total_in_bytes: 24 },
|
memory: { free_in_bytes: 12, total_in_bytes: 24 },
|
||||||
},
|
},
|
||||||
response_times: { max_in_millis: 4 },
|
response_times: { max_in_millis: 4 },
|
||||||
requests: { total: 22, disconnects: 0, status_codes: { '200': 22 } },
|
requests: { total: 22, disconnects: 0 },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,7 +47,6 @@ const assertStatsAndMetrics = body => {
|
||||||
expect(body.response_times.avg_ms).not.to.be(null); // ok if is undefined
|
expect(body.response_times.avg_ms).not.to.be(null); // ok if is undefined
|
||||||
expect(body.response_times.max_ms).not.to.be(null); // ok if is undefined
|
expect(body.response_times.max_ms).not.to.be(null); // ok if is undefined
|
||||||
|
|
||||||
expect(body.requests.status_codes).to.be.an('object');
|
|
||||||
expect(body.requests.total).to.be.a('number');
|
expect(body.requests.total).to.be.a('number');
|
||||||
expect(body.requests.disconnects).to.be.a('number');
|
expect(body.requests.disconnects).to.be.a('number');
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ export default function ({ getService }) {
|
||||||
|
|
||||||
expect(body.metrics.requests.total).to.be.a('number');
|
expect(body.metrics.requests.total).to.be.a('number');
|
||||||
expect(body.metrics.requests.disconnects).to.be.a('number');
|
expect(body.metrics.requests.disconnects).to.be.a('number');
|
||||||
expect(body.metrics.requests.status_codes).to.be.an('object');
|
|
||||||
expect(body.metrics.concurrent_connections).to.be.a('number');
|
expect(body.metrics.concurrent_connections).to.be.a('number');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,7 +31,6 @@ const getInitial = () => {
|
||||||
'requests': {
|
'requests': {
|
||||||
'disconnects': 0,
|
'disconnects': 0,
|
||||||
'total': 2,
|
'total': 2,
|
||||||
'status_codes': { '200': 2 }
|
|
||||||
},
|
},
|
||||||
'response_times': { 'average': 47, 'max': 47 },
|
'response_times': { 'average': 47, 'max': 47 },
|
||||||
'timestamp': '2017-07-26T00:14:20.771Z',
|
'timestamp': '2017-07-26T00:14:20.771Z',
|
||||||
|
@ -94,7 +93,6 @@ const getResult = () => {
|
||||||
'requests': {
|
'requests': {
|
||||||
'disconnects': 0,
|
'disconnects': 0,
|
||||||
'total': 2,
|
'total': 2,
|
||||||
'status_codes': { '200': 2 }
|
|
||||||
},
|
},
|
||||||
'response_times': { 'average': 47, 'max': 47 },
|
'response_times': { 'average': 47, 'max': 47 },
|
||||||
'timestamp': '2017-07-26T00:14:20.771Z',
|
'timestamp': '2017-07-26T00:14:20.771Z',
|
||||||
|
|
|
@ -102,7 +102,6 @@ describe('Event Roller', () => {
|
||||||
requests: {
|
requests: {
|
||||||
disconnects: 0,
|
disconnects: 0,
|
||||||
total: 138, // 103 + 35
|
total: 138, // 103 + 35
|
||||||
status_codes: { '200': 20, '304': 118 }
|
|
||||||
},
|
},
|
||||||
response_times: {
|
response_times: {
|
||||||
average: 5.213592233009709, // max of 5.213592233009709, 4.6
|
average: 5.213592233009709, // max of 5.213592233009709, 4.6
|
||||||
|
|
|
@ -11,7 +11,7 @@ import expect from 'expect.js';
|
||||||
describe('Map requests', () => {
|
describe('Map requests', () => {
|
||||||
it('flatten ports', () => {
|
it('flatten ports', () => {
|
||||||
const requests = { '5603': { total: 1, disconnects: 0, statusCodes: {} } };
|
const requests = { '5603': { total: 1, disconnects: 0, statusCodes: {} } };
|
||||||
const expected = { total: 1, disconnects: 0, status_codes: {} };
|
const expected = { total: 1, disconnects: 0 };
|
||||||
expect(_.isEqual(mapRequests(requests), expected)).to.be(true);
|
expect(_.isEqual(mapRequests(requests), expected)).to.be(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -37,10 +37,6 @@ describe('Map requests', () => {
|
||||||
const expected = {
|
const expected = {
|
||||||
total: 3,
|
total: 3,
|
||||||
disconnects: 44,
|
disconnects: 44,
|
||||||
status_codes: {
|
|
||||||
'200': 22,
|
|
||||||
'201': 4
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
expect(_.isEqual(mapRequests(requests), expected)).to.be(true);
|
expect(_.isEqual(mapRequests(requests), expected)).to.be(true);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import { mapConcurrentConnections } from './map_concurrent_connections';
|
||||||
|
|
||||||
// rollup functions are for objects with unpredictable keys (e.g., {'200': 1, '201': 2} + {'200':2} = {'200': 3, '201': 2})
|
// rollup functions are for objects with unpredictable keys (e.g., {'200': 1, '201': 2} + {'200':2} = {'200': 3, '201': 2})
|
||||||
const maxRollup = partialRight(assign, (latest, prev) => max([latest, prev]));
|
const maxRollup = partialRight(assign, (latest, prev) => max([latest, prev]));
|
||||||
const sumRollup = partialRight(assign, (latest, prev) => sum([latest, prev]));
|
|
||||||
|
|
||||||
export class EventRoller {
|
export class EventRoller {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -68,10 +67,6 @@ export class EventRoller {
|
||||||
this.getFromRollup('requests.disconnects')
|
this.getFromRollup('requests.disconnects')
|
||||||
]),
|
]),
|
||||||
total: sum([requests.total, this.getFromRollup('requests.total')]),
|
total: sum([requests.total, this.getFromRollup('requests.total')]),
|
||||||
status_codes: sumRollup(
|
|
||||||
requests.status_codes,
|
|
||||||
this.getFromRollup('requests.status_codes')
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
response_times: maxRollup(
|
response_times: maxRollup(
|
||||||
mapResponseTimes(event.responseTimes),
|
mapResponseTimes(event.responseTimes),
|
||||||
|
|
|
@ -8,12 +8,8 @@ import _ from 'lodash';
|
||||||
|
|
||||||
export function mapRequests(requests) {
|
export function mapRequests(requests) {
|
||||||
return _.reduce(_.values(requests), (result, value) => {
|
return _.reduce(_.values(requests), (result, value) => {
|
||||||
_.each(value.statusCodes, (count, code) => {
|
|
||||||
if (_.isUndefined(_.get(result, `status_codes.${code}`))) { _.set(result, `status_codes.${code}`, 0); }
|
|
||||||
result.status_codes[code] += count;
|
|
||||||
});
|
|
||||||
result.total += value.total;
|
result.total += value.total;
|
||||||
result.disconnects += value.disconnects;
|
result.disconnects += value.disconnects;
|
||||||
return result;
|
return result;
|
||||||
}, { total: 0, disconnects: 0, status_codes: {} });
|
}, { total: 0, disconnects: 0 });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue