Skip to content
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] Remove kibana_stats.requests.status_codes from bulk uploader #20855

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/server/status/lib/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class Metrics {
},
response_times: {},
requests: {
status_codes: {}
}
};
}
Expand Down
5 changes: 1 addition & 4 deletions src/server/status/lib/metrics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ describe('Metrics', function () {
},
'requests': {
'disconnects': 0,
'status_codes': {
'200': 22
},
'total': 22
},
'response_times': {
Expand All @@ -159,7 +156,7 @@ describe('Metrics', function () {
memory: { free_in_bytes: 12, total_in_bytes: 24 },
},
response_times: { max_in_millis: 4 },
requests: { total: 22, disconnects: 0, status_codes: { '200': 22 } },
requests: { total: 22, disconnects: 0 },
});
});
});
Expand Down
1 change: 0 additions & 1 deletion test/api_integration/apis/stats/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.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.disconnects).to.be.a('number');

Expand Down
1 change: 0 additions & 1 deletion test/api_integration/apis/status/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export default function ({ getService }) {

expect(body.metrics.requests.total).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');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const getInitial = () => {
'requests': {
'disconnects': 0,
'total': 2,
'status_codes': { '200': 2 }
},
'response_times': { 'average': 47, 'max': 47 },
'timestamp': '2017-07-26T00:14:20.771Z',
Expand Down Expand Up @@ -94,7 +93,6 @@ const getResult = () => {
'requests': {
'disconnects': 0,
'total': 2,
'status_codes': { '200': 2 }
},
'response_times': { 'average': 47, 'max': 47 },
'timestamp': '2017-07-26T00:14:20.771Z',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ describe('Event Roller', () => {
requests: {
disconnects: 0,
total: 138, // 103 + 35
status_codes: { '200': 20, '304': 118 }
},
response_times: {
average: 5.213592233009709, // max of 5.213592233009709, 4.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import expect from 'expect.js';
describe('Map requests', () => {
it('flatten ports', () => {
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);
});

Expand All @@ -37,10 +37,6 @@ describe('Map requests', () => {
const expected = {
total: 3,
disconnects: 44,
status_codes: {
'200': 22,
'201': 4
}
};
expect(_.isEqual(mapRequests(requests), expected)).to.be(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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})
const maxRollup = partialRight(assign, (latest, prev) => max([latest, prev]));
const sumRollup = partialRight(assign, (latest, prev) => sum([latest, prev]));

export class EventRoller {
constructor() {
Expand Down Expand Up @@ -68,10 +67,6 @@ export class EventRoller {
this.getFromRollup('requests.disconnects')
]),
total: sum([requests.total, this.getFromRollup('requests.total')]),
status_codes: sumRollup(
requests.status_codes,
this.getFromRollup('requests.status_codes')
)
},
response_times: maxRollup(
mapResponseTimes(event.responseTimes),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ import _ from 'lodash';

export function mapRequests(requests) {
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.disconnects += value.disconnects;
return result;
}, { total: 0, disconnects: 0, status_codes: {} });
}, { total: 0, disconnects: 0 });
}