/// <summary> /// Creates a tracer object for the child process, based on the command line arguments received from the parent process. /// </summary> /// <param name="args">The command line arguments.</param> /// <returns>The tracer instance</returns> public ITracer CreateTracerForChildProcess(string[] args) { ChildProcessArguments arguments = ChildProcessArguments.FromCommandLineArguments(args); // Get sessionId from the arguments and create tracer ITracer tracerForChildProcess = TracerFactory.Create(arguments.SessionId, null, true); // Get custom dimensions from the arguments - do not override existing properties IReadOnlyDictionary <string, string> existingProperties = tracerForChildProcess.GetCustomProperties(); foreach (var kv in arguments.CustomTracerProperties) { if (!existingProperties.ContainsKey(kv.Key)) { tracerForChildProcess.AddCustomProperty(kv.Key, kv.Value); } } return(tracerForChildProcess); }