private static void DoComputerScienceHomework(TimeSpan forHowLong) { //Track work as span SimpleTracer.TrackWork("Do Computer Science Homework", () => { SimpleTracer.CurrentSpan(s => s.WithAttribute("Method", "DoComputerScienceHomework")); Thread.Sleep(forHowLong); }); }
/// <summary> /// This method introduces a delay that is not tracked by a span. /// Its time would be accounted for in the caller's span. /// </summary> /// <param name="forHowLong"></param> private static void TakeABreak(TimeSpan forHowLong) { SimpleTracer.CurrentSpan((s) => { s.WithAttribute("Length of Break", forHowLong.TotalSeconds); }); Thread.Sleep(forHowLong); }