src/middlewares/metrics.js
function generateMetricPayload(ctx) {
	let payload = {
		id: ctx.id,
		requestID: ctx.requestID,
		level: ctx.level,
		startTime: ctx.startTime,
		remoteCall: ctx.nodeID !== ctx.broker.nodeID
	};

	// Process extra metrics
	processExtraMetrics(ctx, payload);

	if (ctx.action) {
		payload.action = {
			name: ctx.action.name
		};
	}
	if (ctx.service) {
		payload.service = {
			name: ctx.service.name,
			version: ctx.service.version
		};
	}

	if (ctx.parentID)
		payload.parent = ctx.parentID;

	payload.nodeID = ctx.broker.nodeID;
	if (payload.remoteCall)
		payload.callerNodeID = ctx.nodeID;

	return payload;
}
function generateMetricPayload(ctx) {
	let payload = {
		id: ctx.id,
		requestID: ctx.requestID,
		level: ctx.level,
		startTime: ctx.startTime,
		remoteCall: ctx.nodeID !== ctx.broker.nodeID
	};

	// Process extra metrics
	processExtraMetrics(ctx, payload);

	if (ctx.action) {
		payload.action = {
			name: ctx.action.name
		};
	}
	if (ctx.service) {
		payload.service = {
			name: ctx.service.name,
			version: ctx.service.version
		};
	}

	if (ctx.parentID)
		payload.parent = ctx.parentID;

	payload.nodeID = ctx.broker.nodeID;
	if (payload.remoteCall)
		payload.callerNodeID = ctx.nodeID;

	return payload;
}
function generateMetricPayload ( ctx ) { let payload = { id : ctx . id , requestID : ctx . requestID , level : ctx . level , startTime : ctx . startTime , remoteCall : ctx . nodeID !== ctx . broker . nodeID } ; // Process extra metrics processExtraMetrics ( ctx , payload ) ; if ( ctx . action ) { payload . action = { name : ctx . action . name } ; } if ( ctx . service ) { payload . service = { name : ctx . service . name , version : ctx . service . version } ; } if ( ctx . parentID ) payload . parent = ctx . parentID ; payload . nodeID = ctx . broker . nodeID ; if ( payload . remoteCall ) payload . callerNodeID = ctx . nodeID ; return payload ; }
Generate metrics payload

@param {Context} ctx
@returns {Object}
Generate metrics payload