public IList <SaveSpansArgs> CreateTestClientSpans(HttpTestConfig config)
        {
            var result   = new List <SaveSpansArgs>();
            var now      = DateHelper.Instance.GetDateNow();
            var ticks    = now.Ticks;
            var traceId  = "trace_" + ticks;
            var tracerId = "ConcurrentTest-Tracer-" + now.ToString("yyyyMMddHHmmss");

            for (int i = 0; i < config.ConcurrentCount; i++)
            {
                var spanId         = "span_" + i.ToString("");
                var saveClientSpan = SaveClientSpan.Create(now, now.AddMilliseconds(10), tracerId, traceId, null, spanId, "FooOp");
                var saveSpansArgs  = new SaveSpansArgs();
                saveSpansArgs.Items.Add(saveClientSpan);
                result.Add(saveSpansArgs);
            }
            return(result);
        }
Пример #2
0
        public static SaveClientSpan Create(DateTime start, DateTime finish, string tracerId, string traceId, string parentSpanId, string spanId, string opName, IDictionary <string, string> bags = null)
        {
            var clientSpan = new SaveClientSpan();

            if (bags != null)
            {
                clientSpan.Bags = bags;
            }

            //todo validate
            clientSpan.TracerId     = tracerId;
            clientSpan.TraceId      = traceId;
            clientSpan.SpanId       = spanId;
            clientSpan.ParentSpanId = parentSpanId;
            clientSpan.OpName       = opName;

            clientSpan.StartUtc  = start;
            clientSpan.FinishUtc = finish;

            return(clientSpan);
        }