private void Send(WavefrontSpan span)
        {
            try
            {
                var context          = (WavefrontSpanContext)span.Context;
                var parentReferences = span.GetParents();
                var followReferences = span.GetFollows();

                var parents = parentReferences?
                              .Select(parent => parent.SpanContext.GetSpanId())
                              .ToList();

                var follows = followReferences?
                              .Select(follow => follow.SpanContext.GetSpanId())
                              .ToList();

                WavefrontSender.SendSpan(
                    span.GetOperationName(), span.GetStartTimeMicros() / 1000,
                    span.GetDurationMicros() / 1000, Source, context.GetTraceId(),
                    context.GetSpanId(), parents, follows, span.GetTagsAsList().ToList(),
                    reportSpanLogs ? span.GetSpanLogs().ToList() : null
                    );
            }
            catch (IOException e)
            {
                if (LoggingAllowed())
                {
                    logger.LogWarning(0, e, "Error reporting span: " + span);
                }
                spansDropped?.Inc();
                reportErrors?.Inc();
            }
        }
Exemplo n.º 2
0
        public void Report(WavefrontSpan span)
        {
            var context          = (WavefrontSpanContext)span.Context;
            var parentReferences = span.GetParents();
            var followReferences = span.GetFollows();

            var parents = parentReferences?
                          .Select(parent => parent.SpanContext.GetSpanId())
                          .ToList();

            var follows = followReferences?
                          .Select(follow => follow.SpanContext.GetSpanId())
                          .ToList();

            var spanLine = Utils.TracingSpanToLineData(
                span.GetOperationName(), span.GetStartTimeMicros(), span.GetDurationMicros(),
                source, context.GetTraceId(), context.GetSpanId(), parents, follows,
                span.GetTagsAsList().ToList(), null, defaultSource
                );

            Console.WriteLine($"Finished span: sampling={context.GetSamplingDecision()} {spanLine}");

            var spanLogs = span.GetSpanLogs();

            if (spanLogs != null && spanLogs.Count > 0)
            {
                try
                {
                    Console.WriteLine("Span logs: " + Utils.SpanLogsToLineData(
                                          context.GetTraceId(), context.GetSpanId(), spanLogs.ToList()));
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error processing span logs: " + e);
                }
            }
        }