Skip to content

Commit

Permalink
Merge branch 'feature/ZENKO-584-crrFailureMetrics' into q/8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Jun 30, 2018
2 parents 801cd26 + 0d740b6 commit 1477c2a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 14 deletions.
11 changes: 9 additions & 2 deletions lib/utilities/reportHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function _crrRequest(backbeatMetrics, rDetails, site, log, cb) {
});
return cb(null, {});
}
const { completions, backlog, throughput } = res;
if (!completions || !backlog || !throughput) {
const { completions, failures, backlog, throughput } = res;
if (!completions || !failures || !backlog || !throughput) {
log.error('could not get metrics from backbeat', {
method: 'getCRRStats',
});
Expand All @@ -119,6 +119,10 @@ function _crrRequest(backbeatMetrics, rDetails, site, log, cb) {
count: parseInt(completions.results.count, 10),
size: parseInt(completions.results.size, 10),
},
failures: {
count: parseInt(failures.results.count, 10),
size: parseInt(failures.results.size, 10),
},
backlog: {
count: parseInt(backlog.results.count, 10),
size: parseInt(backlog.results.size, 10),
Expand Down Expand Up @@ -150,6 +154,8 @@ function getCRRStats(log, cb, _config) {
bytes: 'bb:crr:bytes',
opsDone: 'bb:crr:opsdone',
bytesDone: 'bb:crr:bytesdone',
opsFail: 'bb:crr:opsfail',
bytesFail: 'bb:crr:bytesfail',
failedCRR: 'bb:crr:failed',
};
const routes = backbeat.routes(redisKeys, sites);
Expand Down Expand Up @@ -198,6 +204,7 @@ function getCRRStats(log, cb, _config) {
const byLocation = (res && res.byLocation) || {};
const retObj = {
completions: total.completions,
failures: total.failures,
backlog: total.backlog,
throughput: total.throughput,
byLocation,
Expand Down
27 changes: 18 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"homepage": "https://github.com/scality/S3#readme",
"dependencies": {
"arsenal": "scality/Arsenal#68d27ed",
"arsenal": "github:scality/Arsenal#b3b2229",
"async": "~2.5.0",
"aws-sdk": "2.28.0",
"azure-storage": "^2.1.0",
Expand Down
13 changes: 11 additions & 2 deletions tests/functional/utilities/reportHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,24 @@ const testDetails = {
type: 'all',
extensions: { crr: [...sites, 'all'] },
method: 'getAllMetrics',
dataPoints: ['bb:crr:ops', 'bb:crr:opsdone', 'bb:crr:bytes',
'bb:crr:bytesdone'],
dataPoints: ['bb:crr:ops', 'bb:crr:opsdone', 'bb:crr:opsfail',
'bb:crr:bytes', 'bb:crr:bytesdone', 'bb:crr:bytesfail'],
};

const testCRRKeys = [
['noshow:bb:crr:ops', 10000],
['noshow:bb:crr:bytes', 10000],
['noshow:bb:crr:opsdone', 5000],
['noshow:bb:crr:bytesdone', 5000],
['noshow:bb:crr:opsfail', 1000],
['noshow:bb:crr:bytesfail', 1000],
['noshow:bb:crr:failed', 0],
['test:bb:crr:ops', 10000],
['test:bb:crr:bytes', 10000],
['test:bb:crr:opsdone', 5000],
['test:bb:crr:bytesdone', 5000],
['test:bb:crr:opsfail', 1000],
['test:bb:crr:bytesfail', 1000],
['test:bb:crr:failed', 0],
];

Expand Down Expand Up @@ -103,6 +107,7 @@ describe('reportHandler::_crrRequest', function testSuite() {
assert.ifError(err, `Expected success, but got error ${err}`);
assert.deepStrictEqual(res, {
completions: { count: 10000, size: 10000 },
failures: { count: 2000, size: 2000 },
backlog: { count: 10000, size: 10000 },
throughput: { count: 11, size: 11 },
});
Expand All @@ -116,6 +121,7 @@ describe('reportHandler::_crrRequest', function testSuite() {
assert.ifError(err, `Expected success, but got error ${err}`);
assert.deepStrictEqual(res, {
completions: { count: 5000, size: 5000 },
failures: { count: 1000, size: 1000 },
backlog: { count: 5000, size: 5000 },
throughput: { count: 5, size: 5 },
});
Expand Down Expand Up @@ -152,16 +158,19 @@ describe('reportHandler::getCRRStats', function testSuite() {
assert.ifError(err, `Expected success, but got error ${err}`);
assert.deepStrictEqual(res, {
completions: { count: 10000, size: 10000 },
failures: { count: 2000, size: 2000 },
backlog: { count: 10000, size: 10000 },
throughput: { count: 11, size: 11 },
byLocation: {
test: {
completions: { count: 5000, size: 5000 },
failures: { count: 1000, size: 1000 },
backlog: { count: 5000, size: 5000 },
throughput: { count: 5, size: 5 },
},
noshow: {
completions: { count: 5000, size: 5000 },
failures: { count: 1000, size: 1000 },
backlog: { count: 5000, size: 5000 },
throughput: { count: 5, size: 5 },
},
Expand Down

0 comments on commit 1477c2a

Please sign in to comment.