forked from screwdriver-cd/screwdriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.js
39 lines (35 loc) · 941 Bytes
/
stats.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
const schema = require('screwdriver-data-schema');
/**
* Hapi interface for plugin to set up status endpoint (see Hapi docs)
* @method register
* @param {Hapi.Server} server
* @param {Object} options
* @param {Function} next
*/
exports.register = (server, options, next) => {
const { executor } = options;
const { scm } = options;
server.route({
method: 'GET',
path: '/stats',
config: {
description: 'API stats',
notes: 'Should return statistics for the entire system',
tags: ['api', 'stats'],
response: {
schema: schema.api.stats
}
},
handler: (request, reply) =>
reply({
executor: executor.stats(),
scm: scm.stats()
})
});
next();
};
exports.register.attributes = {
name: 'stats',
version: '1.0.0'
};