예제 #1
0
        public void writeB3SingleFormat_sampled()
        {
            ITraceContext context =
                new SpanState(traceId: 1, parentSpanId: null, spanId: 3, isSampled: true, isDebug: false);
            var b3Format = B3SingleFormat.WriteB3SingleFormat(context);

            Assert.AreEqual(TraceId + '-' + SpanId + "-1", b3Format);
        }
예제 #2
0
        public void writeB3SingleFormat_notYetSampled_128()
        {
            ITraceContext context = new SpanState(traceIdHigh: 9, traceId: 1, parentSpanId: null, spanId: 3,
                                                  isSampled: null, isDebug: false);

            var b3Format = B3SingleFormat.WriteB3SingleFormat(context);

            Assert.AreEqual("0000000000000009" + TraceId + "-" + SpanId, b3Format);
        }
예제 #3
0
        /// <summary>
        /// B3SingleFormat Trace
        /// </summary>
        /// <returns></returns>
        public string GetTrace()
        {
            String parent = null;

            using (var clientTrace = new ClientTrace(_serviceName, null))
            {
                if (clientTrace.Trace != null)
                {
                    var b3Format = B3SingleFormat.WriteB3SingleFormat(clientTrace.Trace.CurrentSpan);
                    parent = b3Format;
                }
            }

            return(parent);
        }
예제 #4
0
 public void Inject(ITraceContext traceContext, C carrier)
 {
     _setter(carrier, _b3Key, B3SingleFormat.WriteB3SingleFormat(traceContext));
 }