How to use the newrelic.startSegment function in newrelic

To help you get started, we’ve selected a few newrelic 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 sergeyksv / tinelic / app.js View on Github external
mod[name] = function (...args) {
						if (!_.isFunction(_.last(args))) return func.call(this, ...args);
						const cb = args.pop();

						const callback = function (err, ...args2) {
							if (err)
								newrelic.noticeError(err);
							cb.call(this, err, ...args2);
						};

						newrelic.startSegment(`api/api/${ns}/${name}`, true, cb => {
							func.call(this, ...args, cb);
						}, callback);
					};
				});