private void OnEventHookTracerOnSpanActivated(object sender, SpanLifecycleEventArgs span)
        {
            // Need to copy to truly be AsyncLocal
            this.curOpNameStack.Value = new Stack <string>(this.curOpNameStack.Value.Reverse());
            this.curOpNameStack.Value.Push(span.OperationName);
            this.ExtendClock();

            this.traceSourceSink.TraceData(
                TraceEventType.Start,
                1,
                new Dictionary <string, object>
            {
                [VectorClockLogKeyName]      = this.CurrentClock(),
                [nameof(span.OperationName)] = span.OperationName
            });
        }
        private void OnEventHookTracerOnSpanFinished(object sender, SpanLifecycleEventArgs span)
        {
            // Need to copy to truly be AsyncLocal
            this.curOpNameStack.Value = new Stack <string>(this.curOpNameStack.Value.Reverse());
            var previousSpan = this.curOpNameStack.Value.Pop();

            if (!string.Equals(previousSpan, span.OperationName))
            {
                throw new InvalidOperationException(
                          "Code error - you finished a span that was not the currently active one");
            }

            this.traceSourceSink.TraceData(
                TraceEventType.Stop,
                2,
                new Dictionary <string, object>
            {
                [VectorClockLogKeyName]      = this.CurrentClock(),
                [nameof(span.OperationName)] = span.OperationName
            });
            this.PopAndIncrementClock();
        }