Skip to content

Conversation

@bennettbuchanan
Copy link

This is the first effort to use forthcoming Backbeat routes for retrieving metrics (to be added by scality/backbeat#200). The next step is to extract metrics accumulation code and move it to Arsenal so that we can avoid making an HTTP request to Backbeat.

method: 'getCRRStats',
error: err,
});
return cb(err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backbeat being down should not cause the whole report to fail so it would be wiser to return (null, {}).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point—I've updated to return (null, {}) in the case of any error in this method. I've left the error logs though.

}
let body;
try {
body = JSON.parse(res.body);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request(...).json() would have the same effect

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I did not know about this.

}
const stats = {
completions: {
count: parseFloat(completions.results.count),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swagger definition expects a int64 instead of a float

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about this: I think we may have to address this in the backbeat code because it reduces the size to a dividend of 1000, and is limited to the second decimal place (for example: here).

We could parse the value as a float and then multiply by 1000, but that limits us to an approximation of the byte count. For example, if replicating a 1024 byte object, we get a size of '1.02' so we can only deduce the value as 1020. Or, in the case of replicating a 1 byte object we get a size of '0.00' which seems undesirable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the approximation is fine, the volume of data that zenko's meant to handle makes the rounding errors not matter much :)

log.debug('getting CRR stats', { method: 'getCRRStats' });
// TODO: Reuse metrics code from Backbeat by moving it to Arsenal instead of
// making an HTTP request to the Backbeat metrics route.
const params = { url: 'http://localhost:8900/_/metrics/crr/all' };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even if it's temporary, having a configuration would be easier because we currently need to support 4 different stacks (swarm, kube, federation, sandboxes) and not all of them are able to reach backbeat at localhost:8900.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to add backbeat as a configuration property.

@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

"site": "us-east-2",
"type": "aws_s3"
}],
"backbeat": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it usable out of the box and ease testing, could we handle CRR_METRICS_HOST and CRR_METRICS_PORT environment variables to update this directly in docker-endpoint.sh?

Copy link
Author

@bennettbuchanan bennettbuchanan Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You got it! Updated so that you can run the image with a custom endpoint as such:

docker run -e CRR_METRICS_HOST=10.100.3.139 -e CRR_METRICS_PORT=1337 a7ae6fa66070

@rachedbenmustapha
Copy link
Contributor

Almost there for the temporary version :)

@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@bennettbuchanan bennettbuchanan force-pushed the ft/add-crr-all-metrics branch from 4a23bd6 to 6ede43b Compare March 16, 2018 02:12
@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

1 similar comment
@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@ironman-machine
Copy link
Contributor

CONFLICT (add/add): Merge conflict in lib/utilities/reportHandler.js
CONFLICT (add/add): Merge conflict in lib/management.js

@bennettbuchanan bennettbuchanan force-pushed the ft/add-crr-all-metrics branch from a56046e to 487e65f Compare March 16, 2018 02:46
@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@rachedbenmustapha
Copy link
Contributor

Ready to squash :)

@rachedbenmustapha rachedbenmustapha merged commit a2b29ff into forward/orbit Mar 16, 2018
@rachedbenmustapha rachedbenmustapha deleted the ft/add-crr-all-metrics branch March 16, 2018 23:38
nicolas2bert pushed a commit that referenced this pull request Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants