Exemplo n.º 1
0
        private void Init(SimpleLoopTask loopTask)
        {
            var processInfos = GetProcessInfos("SimpleTrace.ini");

            foreach (var processInfo in processInfos)
            {
                //var jaegerInfo = SimpleProcessInfo.Create("jaeger-all-in-one", "jaeger-all-in-one.exe", "--collector.zipkin.http-port=9411");
                var process       = SimpleProcess.GetOrCreate(processInfo);
                var processRunner = new SimpleProcessRunner(process);
                LogInfo(string.Format("Init ProcessRunner: [{0}]", processInfo.ProcessName));
                Runners.Add(processRunner);
            }

            loopTask.LoopSpan   = TimeSpan.FromSeconds(15);
            loopTask.LoopAction = () =>
            {
                LogInfo("looping check trace service at " + DateHelper.Instance.GetDateNow().ToString("s"));
                foreach (var runner in Runners)
                {
                    runner.TryStart();
                }
            };

            loopTask.AfterExitLoopAction = () =>
            {
                LogInfo("stopping check trace service at " + DateHelper.Instance.GetDateNow().ToString("s"));
                foreach (var runner in Runners)
                {
                    runner.TryStop();
                }
            };
        }
Exemplo n.º 2
0
        public DaemonService()
        {
            InitializeComponent();

            //var clientProcess = SimpleProcess.GetOrCreate(new SimpleProcessInfo()
            //{
            //    ProcessName = "FooClient",
            //    ExePath = "FooClient.exe",
            //    ExeArgs = null
            //});


            var jaegerProcess = SimpleProcess.GetOrCreate(new SimpleProcessInfo()
            {
                ProcessName = "jaeger-all-in-one",
                ExePath     = "jaeger-all-in-one.exe",
                ExeArgs     = "--collector.zipkin.http-port=9411"
            });

            var runner = new SimpleProcessRunner(jaegerProcess);

            LoopTask = new SimpleLoopTask();
            Init(LoopTask, runner);
        }