public static void NotifyFinish(ITraceSegment traceSegment) { foreach (var listener in _listeners) { listener.AfterFinished(traceSegment); } }
public void AfterFinished(ITraceSegment traceSegment) { if (!traceSegment.IsIgnore) { _dispatcher.Dispatch(traceSegment.Transform()); } }
public async void AfterFinished(ITraceSegment traceSegment) { var segment = traceSegment.Transform(); var traceSegmentService = new TraceSegmentService.TraceSegmentServiceClient(GrpcChannelManager.Instance.Channel); using (var asyncClientStreamingCall = traceSegmentService.collect()) { await asyncClientStreamingCall.RequestStream.WriteAsync(segment); await asyncClientStreamingCall.RequestStream.CompleteAsync(); } }
public async void AfterFinished(ITraceSegment traceSegment) { if (traceSegment.IsIgnore) { return; } if (_traceSegments.Count >= AgentConfig.PendingSegmentsLimit && AgentConfig.PendingSegmentsLimit > 0) { _traceSegments.TryDequeue(out var v); } _traceSegments.Enqueue(traceSegment); }
public async void AfterFinished(ITraceSegment traceSegment) { if (traceSegment.IsIgnore) { return; } var availableConnection = GrpcConnectionManager.Instance.GetAvailableConnection(); if (availableConnection == null) { _logger.Warning( $"Transform and send UpstreamSegment to collector fail. {GrpcConnectionManager.NotFoundErrorMessage}"); return; } try { var segment = traceSegment.Transform(); var traceSegmentService = new TraceSegmentService.TraceSegmentServiceClient(availableConnection.GrpcChannel); using (var asyncClientStreamingCall = traceSegmentService.collect()) { await asyncClientStreamingCall.RequestStream.WriteAsync(segment); await asyncClientStreamingCall.RequestStream.CompleteAsync(); await asyncClientStreamingCall.ResponseAsync; } _logger.Debug( $"Transform and send UpstreamSegment to collector. [TraceSegmentId] = {traceSegment.TraceSegmentId} [GlobalTraceId] = {traceSegment.RelatedGlobalTraces.FirstOrDefault()}"); } catch (Exception e) { _logger.Warning($"Transform and send UpstreamSegment to collector fail. {e.Message}"); availableConnection?.Failure(); } }
/// <summary> /// Finish the active Span. When it is finished, it will be archived by the given {@link TraceSegment}, which owners it /// </summary> /// <param name="owner"></param> /// <returns></returns> public virtual bool Finish(ITraceSegment owner) { _endTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); owner.Archive(this); return(true); }
public TracingContext() { _sampler = ServiceManager.Instance.GetService <SamplingService>(); _segment = new TraceSegment(); _activeSpanStacks = new Stack <ISpan>(); }
public void AfterFinished(ITraceSegment traceSegment) { _context.Value = null; }
public TracingContext() { _sampler = DefaultSampler.Instance; _segment = new TraceSegment(); _activeSpanStacks = new Stack <ISpan>(); }
/// <summary> /// Finish the active Span. When it is finished, it will be archived by the given {@link TraceSegment}, which owners it /// </summary> /// <param name="owner"></param> /// <returns></returns> public virtual bool Finish(ITraceSegment owner) { _endTime = DateTime.UtcNow.GetTimeMillis(); owner.Archive(this); return(true); }
public virtual bool Finish(ITraceSegment owner) { _endTime = DateTimeOffset.UtcNow; owner.Archive(this); return(true); }
public TracingContext() { _activeSpanStacks = new Stack <ISpan>(); _segment = new TraceSegment(); }
public ConcurrentTraceContext() { _sampler = DefaultSampler.Instance; _segment = new TraceSegment(); _activeSpanDic = new ConcurrentDictionary <string, ISpan>(); }