MCPcopy
hub / github.com/scality/cloudserver / monitoringHandler

Function monitoringHandler

lib/utilities/monitoringHandler.js:254–270  ·  view source on GitHub ↗

* Checks if client IP address is allowed to make http request to * S3 server. Defines function 'montiroingEndHandler', which is * called if IP not allowed or passed as callback. * @param {string | undefined} clientIP - IP address of client * @param {http.IncomingMessage} req - http request objec

(clientIP, req, res, log)

Source from the content-addressed store, hash-verified

252 * @return {void}
253 */
254function monitoringHandler(clientIP, req, res, log) {
255 function monitoringEndHandler(err, results) {
256 writeResponse(res, err, results, error => {
257 if (error) {
258 return log.end().warn('monitoring error', { err: error });
259 }
260 return log.end();
261 });
262 }
263 if (req.method !== 'GET') {
264 return monitoringEndHandler(errors.MethodNotAllowed, []);
265 }
266 if (req.url !== '/metrics') {
267 return monitoringEndHandler(errors.MethodNotAllowed, []);
268 }
269 return routeHandler(req, res, monitoringEndHandler);
270}
271
272module.exports = {
273 monitoringHandler,

Callers

nothing calls this directly

Calls 2

monitoringEndHandlerFunction · 0.85
routeHandlerFunction · 0.70

Tested by

no test coverage detected