Esempio n. 1
0
 /// <summary>
 ///     Reports an OpenTracing span using each of the delegate reporters.
 /// </summary>
 /// <param name="span">The <see cref="WavefrontSpan"/> to report.</param>
 public void Report(WavefrontSpan span)
 {
     foreach (var reporter in reporters)
     {
         reporter.Report(span);
     }
 }
        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();
            }
        }
        /// <inheritdoc />
        public void Report(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.GetStartTimeMillis(), span.GetDurationMillis(),
                    source, context.GetTraceId(), context.GetSpanId(), parents, follows,
                    span.GetTagsAsList().ToList(), null
                    );
            }
            catch (IOException)
            {
                if (logger.IsEnabled(LogLevel.Debug))
                {
                    logger.Log(LogLevel.Debug, "Dropping span " + span);
                }
            }
        }
 /// <inheritdoc />
 public void Report(WavefrontSpan span)
 {
     spansReceived?.Inc();
     if (!spanBuffer.TryAdd(span))
     {
         spansDropped?.Inc();
         if (LoggingAllowed())
         {
             logger.LogWarning("Buffer full, dropping span: " + span);
             if (spansDropped != null)
             {
                 logger.LogWarning("Total spans dropped: " + spansDropped.Count);
             }
         }
     }
 }
Esempio n. 5
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.GetStartTimeMillis(), span.GetDurationMillis(),
                source, context.GetTraceId(), context.GetSpanId(), parents, follows,
                span.GetTagsAsList().ToList(), null, "unknown"
                );

            Console.WriteLine("Finished span: " + spanLine);
        }
Esempio n. 6
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);
                }
            }
        }
 private static long FinishTimeMillis(WavefrontSpan span)
 {
     return(span.GetStartTimeMillis() + span.GetDurationMillis());
 }