示例#1
0
        public async Task <bool> HandleAsync(TracingEvent @event, CancellationToken cancellationToken = default(CancellationToken))
        {
            /// 需要增加缓存区
            var span = @event.TraceSpan;

            if (span != null)
            {
                var StartTime = DateTime.Now;
                var spans     = new List <Span> {
                    span
                };
                await _spanStorage.StoreAsync(spans);

                var TimeLength = Math.Round((DateTime.Now - StartTime).TotalMilliseconds, 4);
                Console.WriteLine("es数据创建耗时" + TimeLength + "毫秒");
            }
            return(true);
        }
示例#2
0
        public async Task Handle(TracingEvent @event)
        {
            try
            {
                /// 需要增加缓存区
                var span = @event.TraceSpan;
                if (span != null)
                {
                    //var StartTime = DateTime.Now;
                    await _spanStorage.StoreAsync(new List <Span> {
                        span
                    });

                    //var TimeLength = Math.Round((DateTime.Now - StartTime).TotalMilliseconds, 4);
                    //Console.WriteLine("Elasticsearch数据创建耗时" + TimeLength + "毫秒");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Tracing消费:" + ex.Message);
            }
        }
示例#3
0
        public async Task Handle(TracingEvent @event)
        {
            try
            {
                /// 需要增加缓存区
                var span = @event.TraceSpan;
                if (span != null)
                {
                    await _spanStorage.StoreAsync(span);

                    var service = new Service {
                        Name = span?.Tags?.FirstOrDefault(x => x.Key == "service.name")?.Value
                    };
                    await _serviceStorage.StoreServiceAsync(new List <Service> {
                        service
                    });
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Tracing消费异常:" + ex.Message);
            }
        }
 public async Task InvokeAsync(IEnumerable <Span> spans, CancellationToken cancellationToken)
 {
     await _spanStorage.StoreAsync(spans, cancellationToken);
 }
 public Task InvokeAsync(IEnumerable <Span> spans, CancellationToken cancellationToken)
 {
     return(_spanStorage.StoreAsync(spans, cancellationToken));
 }