Skip to content

Commit

Permalink
Merge branch 'improvement/BB-368-upgrade-prom-client' into q/7.10
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Mar 16, 2023
2 parents f910958 + 3bd11b4 commit 4ada919
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"extends": "scality",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
"experimentalObjectRestSpread": true
},
"ecmaVersion": 6
"ecmaVersion": 2017
},
"settings": {
"import/resolver": {
Expand Down
5 changes: 3 additions & 2 deletions extensions/replication/queueProcessor/QueueProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ class QueueProcessor extends EventEmitter {
* @param {Logger} log - Logger
* @returns {string} Error response string or undefined
*/
handleMetrics(res, log) {
async handleMetrics(res, log) {
log.debug('metrics requested');

// consumer stats lag is on a different update cycle so we need to
Expand All @@ -574,11 +574,12 @@ class QueueProcessor extends EventEmitter {
serviceName: this.serviceName,
}, lagStats[partition]);
});
const metrics = await promClient.register.metrics();

res.writeHead(200, {
'Content-Type': promClient.register.contentType,
});
res.end(promClient.register.metrics());
res.end(metrics);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const http = require('http');
const https = require('https');
const async = require('async');
const { each } = require('async');

const Logger = require('werelogs').Logger;
const errors = require('arsenal').errors;
Expand Down Expand Up @@ -340,7 +340,7 @@ class ReplicationStatusProcessor {
if (err) {
return cb(err);
}
return async.each(this._replayTopicNames, (topicName, next) =>
return each(this._replayTopicNames, (topicName, next) =>
this._ReplayProducers[topicName].setupProducer(next), cb);
});
});
Expand Down Expand Up @@ -445,7 +445,7 @@ class ReplicationStatusProcessor {
* @param {Logger} log - Logger
* @returns {string} Error response string or undefined
*/
handleMetrics(res, log) {
async handleMetrics(res, log) {
log.debug('metrics requested');

const serviceName = constants.services.replicationStatusProcessor;
Expand All @@ -458,11 +458,12 @@ class ReplicationStatusProcessor {
this.metricsHandlers.lag({ partition, serviceName }, lagStats[partition]);
});
}
const metrics = await promClient.register.metrics();

res.writeHead(200, {
'Content-Type': promClient.register.contentType,
});
res.end(promClient.register.metrics());
res.end(metrics);
}
}

Expand Down
17 changes: 9 additions & 8 deletions lib/queuePopulator/QueuePopulator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const async = require('async');
const { each, series } = require('async');
const Logger = require('werelogs').Logger;
const zookeeper = require('../clients/zookeeper');
const { State: ZKState } = require('node-zookeeper-client');
Expand Down Expand Up @@ -140,7 +140,7 @@ class QueuePopulator {
* @return {undefined}
*/
open(cb) {
async.series([
series([
next => this._setupMetricsClients(next),
next => this._setupFailedCRRClients(next),
next => this._setupZookeeper(next),
Expand Down Expand Up @@ -331,7 +331,7 @@ class QueuePopulator {
}

_setupExtensions(cb) {
return async.each(this._extensions, (ext, next) => {
return each(this._extensions, (ext, next) => {
ext.setupZookeeper(err => {
if (err) {
return next(err);
Expand All @@ -347,14 +347,14 @@ class QueuePopulator {
_setupUpdatedReaders(done) {
const newReaders = this.logReadersUpdate;
this.logReadersUpdate = null;
async.each(
each(
newReaders,
(logReader, cb) => logReader.setup(cb),
err => {
if (err) {
return done(err);
}
return async.each(
return each(
this.logReaders, (logReader, cb) => logReader.close(cb),
() => {
this.logReaders = newReaders;
Expand All @@ -372,7 +372,7 @@ class QueuePopulator {
}

_processAllLogEntries(params, done) {
return async.each(
return each(
this.logReaders,
(logReader, readerDone) => {
const batchCb = (err, processedAll) => {
Expand Down Expand Up @@ -467,12 +467,13 @@ class QueuePopulator {
* @param {Logger} log - Logger
* @returns {string} Error response string or undefined
*/
handleMetrics(res, log) {
async handleMetrics(res, log) {
log.debug('metrics requested');
const metrics = await promClient.register.metrics();
res.writeHead(200, {
'Content-Type': promClient.register.contentType,
});
res.end(promClient.register.metrics());
res.end(metrics);
}
}

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backbeat",
"version": "7.10.4",
"version": "7.10.9",
"description": "Asynchronous queue and job manager",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -37,19 +37,19 @@
"homepage": "https://github.com/scality/backbeat#readme",
"dependencies": {
"@hapi/joi": "^15.1.0",
"arsenal": "git+https://github.com/scality/arsenal#7.10.44",
"arsenal": "git+https://github.com/scality/arsenal#7.10.46",
"async": "^2.3.0",
"aws-sdk": "^2.1326.0",
"backo": "^1.1.0",
"bucketclient": "git+https://github.com/scality/bucketclient#7.10.4",
"bucketclient": "git+https://github.com/scality/bucketclient#7.10.6",
"commander": "^2.11.0",
"fcntl": "git+https://github.com/scality/node-fcntl#0.2.1",
"node-rdkafka": "^2.12.0",
"node-schedule": "^1.2.0",
"node-zookeeper-client": "^1.1.3",
"prom-client": "^12.0.0",
"prom-client": "14.2.0",
"uuid": "^3.1.0",
"vaultclient": "git+https://github.com/scality/vaultclient#7.10.8",
"vaultclient": "git+https://github.com/scality/vaultclient#7.10.13",
"werelogs": "git+https://github.com/scality/werelogs#7.10.3.9"
},
"devDependencies": {
Expand Down
41 changes: 21 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,10 @@ arraybuffer.slice@~0.0.7:
resolved "https://registry.yarnpkg.com/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz#3bbc4275dd584cc1b10809b89d4e8b63a69e7675"
integrity sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==

"arsenal@git+https://github.com/scality/Arsenal#7.10.28":
version "7.10.28"
resolved "git+https://github.com/scality/Arsenal#acf38cc01020ea64600947d7d2e09a8ccc73ecfd"
"arsenal@git+https://github.com/scality/Arsenal#7.10.46":
version "7.10.46"
uid bd76402586f1b5117ada9857a9e437727562d55a
resolved "git+https://github.com/scality/Arsenal#bd76402586f1b5117ada9857a9e437727562d55a"
dependencies:
"@types/async" "^3.2.12"
"@types/utf8" "^3.0.1"
Expand All @@ -708,7 +709,7 @@ arraybuffer.slice@~0.0.7:
level-sublevel "~6.6.5"
mongodb "^3.0.1"
node-forge "^0.7.1"
prom-client "10.2.3"
prom-client "14.2.0"
simple-glob "^0.2"
socket.io "~2.3.0"
socket.io-client "~2.3.0"
Expand Down Expand Up @@ -800,9 +801,9 @@ arraybuffer.slice@~0.0.7:
optionalDependencies:
ioctl "^2.0.2"

"arsenal@git+https://github.com/scality/arsenal#7.10.44":
version "7.10.44"
resolved "git+https://github.com/scality/arsenal#acd13ff31b92b3d9469e8625c9a9f671d06a1ec2"
"arsenal@git+https://github.com/scality/arsenal#7.10.46":
version "7.10.46"
resolved "git+https://github.com/scality/arsenal#bd76402586f1b5117ada9857a9e437727562d55a"
dependencies:
"@types/async" "^3.2.12"
"@types/utf8" "^3.0.1"
Expand All @@ -828,7 +829,7 @@ arraybuffer.slice@~0.0.7:
level-sublevel "~6.6.5"
mongodb "^3.0.1"
node-forge "^0.7.1"
prom-client "10.2.3"
prom-client "14.2.0"
simple-glob "^0.2"
socket.io "~2.3.0"
socket.io-client "~2.3.0"
Expand Down Expand Up @@ -1181,12 +1182,12 @@ bson@~1.0.4:
resolved "https://registry.yarnpkg.com/bson/-/bson-1.0.9.tgz#12319f8323b1254739b7c6bef8d3e89ae05a2f57"
integrity sha512-IQX9/h7WdMBIW/q/++tGd+emQr0XMdeZ6icnT/74Xk9fnabWn+gZgpE+9V+gujL3hhJOoNrnDVY7tWdzc7NUTg==

"bucketclient@git+https://github.com/scality/bucketclient#7.10.4":
version "7.10.4"
resolved "git+https://github.com/scality/bucketclient#08b8e1b1cd95651e231ccc88ec449f5b1c900304"
"bucketclient@git+https://github.com/scality/bucketclient#7.10.6":
version "7.10.6"
resolved "git+https://github.com/scality/bucketclient#115ab1ae974781aafaba455cf83228b1732191af"
dependencies:
agentkeepalive "^4.1.4"
arsenal "git+https://github.com/scality/Arsenal#7.10.28"
arsenal "git+https://github.com/scality/Arsenal#7.10.46"
werelogs scality/werelogs#8.1.0

bucketclient@scality/bucketclient#8.1.5:
Expand Down Expand Up @@ -4545,10 +4546,10 @@ prom-client@10.2.3:
dependencies:
tdigest "^0.1.1"

prom-client@^12.0.0:
version "12.0.0"
resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-12.0.0.tgz#9689379b19bd3f6ab88a9866124db9da3d76c6ed"
integrity sha512-JbzzHnw0VDwCvoqf8y1WDtq4wSBAbthMB1pcVI/0lzdqHGJI3KBJDXle70XK+c7Iv93Gihqo0a5LlOn+g8+DrQ==
prom-client@14.2.0:
version "14.2.0"
resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-14.2.0.tgz#ca94504e64156f6506574c25fb1c34df7812cf11"
integrity sha512-sF308EhTenb/pDRPakm+WgiN+VdM/T1RaHj1x+MvAuT8UiQP8JmOEbxVqtkbfR4LrvOg5n7ic01kRBDGXjYikA==
dependencies:
tdigest "^0.1.1"

Expand Down Expand Up @@ -5823,12 +5824,12 @@ vary@~1.1.2:
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==

"vaultclient@git+https://github.com/scality/vaultclient#7.10.8":
version "7.10.8"
resolved "git+https://github.com/scality/vaultclient#aab460b592ca3ad8422bfa8f46b2a27cb6ca2b75"
"vaultclient@git+https://github.com/scality/vaultclient#7.10.13":
version "7.10.13"
resolved "git+https://github.com/scality/vaultclient#e9876b8d492ccad9ac5ab72404b32ea9a31fc1e3"
dependencies:
agentkeepalive "^4.1.3"
arsenal "git+https://github.com/scality/Arsenal#7.10.28"
arsenal "git+https://github.com/scality/Arsenal#7.10.46"
commander "2.20.0"
werelogs "git+https://github.com/scality/werelogs#8.1.0"
xml2js "0.4.19"
Expand Down

0 comments on commit 4ada919

Please sign in to comment.