public Result Post([FromQuery] string callId, [FromBody] RowEvent[] rowEvents) { // var rowEvents = JsonConvert.DeserializeObject<List<RowEvent>>(rawData); MermaidMarkdown mermaidMarkdown = new MermaidMarkdown(); if (rowEvents.Any() == false) { Console.WriteLine("No event found"); return(null); } Console.WriteLine($"Found event{rowEvents.Count()}"); RowEventExport eventExport = new RowEventExport(); eventExport.SaveEventToFile(rowEvents, callId); var events = (new EventConvertor()).Convert(rowEvents); var orderManger = new OrderManger(); var serverAndClientEvents = orderManger.EnrichDataClientOrServerEvent(events); if (serverAndClientEvents.Any() == false) { if (rowEvents.Any() == false) { Console.WriteLine("No flow found"); return(null); } else { return(new Result { Events = events.ToList() , MermaidMarkdown = mermaidMarkdown.Draw(events.Where(e => e is RequestEventModel)), RequestTags = GetReqestTags(rowEvents).ToList() }); } } var orderClientAndServerOnly = orderManger.OrderClientAndServer(serverAndClientEvents); var orderEvents = orderManger.AddRequest(events.SingleOrDefault(e => e is RequestEventModel), orderClientAndServerOnly); var mermaidMarkdownResult = mermaidMarkdown.Draw(orderEvents); return(new Result { Events = events.ToList(), MermaidMarkdown = mermaidMarkdownResult , OrdererFlow = orderEvents.ToList() , RequestTags = GetReqestTags(rowEvents)?.ToList() }); }
public static async Task Main(string[] args) { if (args.Length == 0 || args.Length > 2) { Console.WriteLine( "You mast pass callID as the first argument there is also option to filter actor like Hades,Sql"); Console.ReadLine(); return; } string filter = null; string callId = args[0]; if (args.Length == 2) { filter = args[1]; } ElasticsearchAdapter manger = new ElasticsearchAdapter(); IEnumerable <RowEvent> rowEvents = await manger.GetData(callId); if (rowEvents.Any() == false) { Console.WriteLine("No event found"); return; } Console.WriteLine($"Found event{rowEvents.Count()}"); RowEventExport eventExport = new RowEventExport(); eventExport.SaveEventToFile(rowEvents, callId); var events = (new EventConvertor()).Convert(rowEvents); var orderManger = new OrderManger(); var serverAndClientEvents = orderManger.EnrichDataClientOrServerEvent(events); if (serverAndClientEvents.Any() == false) { if (rowEvents.Any() == false) { Console.WriteLine("No flow found"); return; } } var orderClientAndServerOnly = orderManger.OrderClientAndServer(serverAndClientEvents); var orderEvents = orderManger.AddRequest(events.SingleOrDefault(e => e is RequestEventModel), orderClientAndServerOnly); MermaidMarkdown mermaidMarkdown = new MermaidMarkdown(); var result = mermaidMarkdown.Draw(orderEvents); if (filter != null) { if (filter.Contains(",")) { var filterBy = filter.Split(','); foreach (var f in filterBy) { result.RemoveAll(x => x.Contains(f)); } } else { result.RemoveAll(x => x.Contains(filter)); } } WebDraw.Draw(result, callId); var p = new Process { StartInfo = new ProcessStartInfo($@"{callId}.html") { UseShellExecute = true } }; p.Start(); Console.WriteLine("Done"); }