bigbluebutton-Github/bigbluebutton-html5/imports/startup/server/prom-metrics/index.js
germanocaumo a0580431e0 feat(html5-server): add prometheus default instrumentation
Adds prometheus client to collect html5 server metrics.
Only default Node.js metrics in this initial version.

Enable via configs in private.app.prometheus
2021-10-06 18:55:19 +00:00

29 lines
646 B
JavaScript

const Agent = require('./promAgent.js');
const METRICS_PREFIX = "html5_"
const {
enabled: METRICS_ENABLED,
host: METRICS_HOST,
port: METRICS_PORT,
path: METRICS_PATH,
collectDefaultMetrics: COLLECT_DEFAULT_METRICS,
} = Meteor.settings.private.prometheus
? Meteor.settings.private.prometheus
: { enabled: false };
const MCSPrometheusAgent = new Agent(METRICS_HOST, METRICS_PORT, {
path: METRICS_PATH,
prefix: METRICS_PREFIX,
collectDefaultMetrics: COLLECT_DEFAULT_METRICS,
});
if (METRICS_ENABLED) {
MCSPrometheusAgent.start();
}
module.exports = {
METRICS_PREFIX,
Agent,
MCSPrometheusAgent,
};