Пример #1
0
        public override async Task <Empty> StopSpan(StopSpanRequest request, ServerCallContext context)
        {
            await _uiUpdateHub.Clients.All.SendAsync("StopSpan", request);

            var span = await _dbContext.Spans.SingleOrDefaultAsync(s => s.SpanIdentifier == request.SpanIdentifier);

            if (span == null)
            {
                _logger.LogWarning($"No span for { request.SpanIdentifier}, skipping");
                return(new Empty());
            }

            span.StoppedAtUtc = DateTime.UtcNow;

            var ongoingSpans = await _dbContext.Spans.AnyAsync(s => s.TraceIdentifier == request.TraceIdentifier && s.StoppedAtUtc != null);

            if (!ongoingSpans)
            {
                var trace = await _dbContext.Traces.SingleOrDefaultAsync(t => t.TraceIdentifier == request.TraceIdentifier);

                trace.StoppedAtUtc = DateTime.UtcNow;
            }

            await _dbContext.SaveChangesAsync();

            return(new Empty());
        }
Пример #2
0
 public async Task StopSpan(StopSpanRequest requestUpdate)
 {
     await _client.StopSpanAsync(requestUpdate);
 }