コード例 #1
0
 public void Report(IJaegerCoreSpan span)
 {
     foreach (var reporter in _reporters)
     {
         reporter.Report(span);
     }
 }
コード例 #2
0
 public void ReportSpan(IJaegerCoreSpan span)
 {
     if (span.Context.IsSampled)
     {
         Reporter.Report(span);
         Metrics.SpansFinished.Inc(1);
     }
 }
コード例 #3
0
        // TODO: setup baggage restriction
        public IJaegerCoreSpan SetBaggageItem(IJaegerCoreSpan span, string key, string value)
        {
            var context = (SpanContext)span.Context;
            var baggage = context.GetBaggageItems().ToDictionary(b => b.Key, b => b.Value);

            baggage[key] = value;
            context.SetBaggageItems(baggage);
            return(span);
        }
コード例 #4
0
        /// <summary>
        /// AppendAsync serializes the passed in span into Jaeger Thrift and passes it off
        /// to the sender which will buffer it to be sent. If the buffer is full enough it
        /// will be flushed and the number of spans sent will be returned. If the buffer is
        /// not full enough, nothing will be done and a 0 will be returned to indicate that 0
        /// spans were sent.
        /// </summary>
        /// <param name="span">The span to serialize into Jaeger Thrift and buffer to be sent</param>
        /// <param name="cancellationToken"></param>
        /// <returns>The number of spans flushed, if any</returns>
        public async Task <int> AppendAsync(IJaegerCoreSpan span, CancellationToken cancellationToken)
        {
            if (_process == null)
            {
                _process = _jaegerThriftSerialization.BuildJaegerProcessThrift(span.Tracer);
            }

            var jaegerSpan = _jaegerThriftSerialization.BuildJaegerThriftSpan(span);

            return(await ProtocolAppendLogicAsync(jaegerSpan, cancellationToken));
        }
コード例 #5
0
 // TODO: Make async!
 public async void Report(IJaegerCoreSpan span)
 {
     try
     {
         // TODO: This Task should be queued and be processed in a separate thread
         await _transport.AppendAsync(span, CancellationToken.None).ConfigureAwait(false);
     }
     catch (Exception e)
     {
         _logger.LogError(e, "Unable to report span in RemoteReporter");
         _metrics.ReporterDropped.Inc(1);
     }
 }
コード例 #6
0
        public JaegerSpan BuildJaegerThriftSpan(IJaegerCoreSpan span)
        {
            var context   = span.Context;
            var startTime = span.StartTimestampUtc.ToUnixTimeMicroseconds();
            var duration  = (span.FinishTimestampUtc?.ToUnixTimeMicroseconds() - startTime) ?? 0;

            var jaegerSpan = new JaegerSpan(
                (long)context.TraceId.Low,
                (long)context.TraceId.High,
                context.SpanId,
                context.ParentId,
                span.OperationName,
                0,
                startTime,
                duration
                )
            {
                Tags       = BuildJaegerTags(span.Tags),
                Logs       = span.Logs.Select(BuildJaegerLog).ToList(),
                References = span.References.Select(BuildJaegerReference).Where(r => r != null).ToList()
            };

            return(jaegerSpan);
        }
コード例 #7
0
 public void Report(IJaegerCoreSpan span)
 {
 }
コード例 #8
0
 public void Report(IJaegerCoreSpan span) => Logger.LogInformation($"Reporting span:\n {JsonConvert.SerializeObject(span, Formatting.Indented)}");