mirror of https://github.com/calzoneman/sync.git
database: include legacy query() in prometheus metrics
This commit is contained in:
parent
82004aab73
commit
c6c3bafca2
|
@ -120,6 +120,7 @@ module.exports.query = function (query, sub, callback) {
|
|||
console.log(query);
|
||||
}
|
||||
|
||||
const end = queryLatency.startTimer();
|
||||
db.knex.raw(query, sub)
|
||||
.then(res => {
|
||||
process.nextTick(callback, null, res[0]);
|
||||
|
@ -127,7 +128,9 @@ module.exports.query = function (query, sub, callback) {
|
|||
LOGGER.error('Legacy DB query failed. Query: %s, Substitutions: %j, Error: %s', query, sub, error);
|
||||
process.nextTick(callback, 'Database failure', null);
|
||||
}).finally(() => {
|
||||
end();
|
||||
Metrics.stopTimer(timer);
|
||||
queryCount.inc(1, new Date());
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue