How to use the service-runner.getMetrics function in service-runner

To help you get started, we’ve selected a few service-runner examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikimedia / parsoid / lib / config / ParsoidConfig.js View on Github external
this._uniq = 0;

	// Don't freak out!
	// This happily overwrites inherited properties.
	Object.assign(this, options);

	if (options.parent && (!this.loggerBackend || !this.metrics)) {
		var srlogger = ServiceRunner.getLogger(options.parent.logging);
		if (!this.loggerBackend) {
			this.loggerBackend = function(logData, cb) {
				srlogger.log(logData.logType, prepareLog(logData));
				cb();
			};
		}
		if (!this.metrics) {
			this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
		}
	}

	if (!localSettings && options.localsettings) {
		localSettings = require(options.localsettings);
	}

	if (localSettings && localSettings.setup) {
		localSettings.setup(this);
	}

	// Call setMwApi for each specified API.
	if (Array.isArray(this.mwApis)) {
		this.mwApis.forEach(function(api) {
			this.setMwApi(api);
		}, this);
github wikimedia / parsoid / lib / config / ParsoidConfig.js View on Github external
['traceFlags', 'debugFlags', 'dumpFlags'].forEach(function(f) {
		if (Array.isArray(this[f])) {
			this[f] = new Set(this[f]);
		}
	}, this);

	if (options.parent && (!this.loggerBackend || !this.metrics)) {
		var srlogger = ServiceRunner.getLogger(options.parent.logging);
		if (!this.loggerBackend) {
			this.loggerBackend = function(logData, cb) {
				srlogger.log(logData.logType, prepareLog(logData));
				cb();
			};
		}
		if (!this.metrics) {
			this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
		}
	}

	if (!localSettings && options.localsettings) {
		localSettings = require(options.localsettings);
	}

	if (localSettings && localSettings.setup) {
		localSettings.setup(this);
	}

	// Call setMwApi for each specified API.
	if (Array.isArray(this.mwApis)) {
		this.mwApis.forEach(function(api) {
			this.setMwApi(api);
		}, this);

service-runner

Generic nodejs service supervisor / cluster runner

Apache-2.0
Latest version published 2 months ago

Package Health Score

70 / 100
Full package analysis

Popular service-runner functions