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()); }
public async Task StopSpan(StopSpanRequest requestUpdate) { await _client.StopSpanAsync(requestUpdate); }