Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function tracedOutgoingRemoteCall(method, data) {
const tracer = Api.traceOutgoingRemoteCall({
serviceEndpoint: "ChildProcess",
serviceMethod: method, // the name of the remote method called
serviceName: "StringManipulator",
channelType: Sdk.ChannelType.NAMED_PIPE
});
try {
// start tracer, get dynatrace tag and trigger sending via doOutgoingRemoteCall()
return await tracer.start(function triggerTaggedRemoteCall() {
// getting a tag from tracer needs to be done after start()
const dtTag = tracer.getDynatraceStringTag();
// now trigger the actual remote call
return doOutgoingRemoteCall(method, data, dtTag);
});
} catch (e) {
tracer.error(e);
throw e;
} finally {
tracer.end();
}