mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Add "Open XEL file" support to profiler in sqltoolsservice (#2091)
* Open XEL file changes * placeholders for openxel * add observable xe reader * md format tweaks * implement localfile as a new session type * add ErrorMessage to session stopped notice * fix flaky test * handle already running session * fix stopped session event send on file completion * fix flaky unit test * Update XElite and dependent versions * Fix errors after merge and remove failing tests for now * Fix main merge mess-up. Address comments. Add one more relevant test. * Remove extra namespace. * Remove unnecessary import * Fix build error * Address comments. * Remove disabiling JSON002 compiler warning * Address comments and update json handling * Fix build error * Fix integration test (emerged due to Main merge mess up) * Clean up code (no functional changes) --------- Co-authored-by: Karl Burtram <karlb@microsoft.com> Co-authored-by: shueybubbles <david.shiflet@microsoft.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.Profiler;
|
||||
@@ -37,21 +38,24 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler
|
||||
|
||||
public class TestSessionListener : IProfilerSessionListener
|
||||
{
|
||||
public string PreviousSessionId { get; set; }
|
||||
public readonly Dictionary<string, List<ProfilerEvent>> AllEvents = new Dictionary<string, List<ProfilerEvent>>();
|
||||
|
||||
public List<ProfilerEvent> PreviousEvents { get; set; }
|
||||
|
||||
public bool Stopped { get; set; }
|
||||
public readonly List<string> StoppedSessions = new List<string>();
|
||||
public readonly List<string> ErrorMessages = new List<string>();
|
||||
|
||||
public void EventsAvailable(string sessionId, List<ProfilerEvent> events, bool eventsLost)
|
||||
{
|
||||
this.PreviousSessionId = sessionId;
|
||||
this.PreviousEvents = events;
|
||||
if (!AllEvents.ContainsKey(sessionId))
|
||||
{
|
||||
AllEvents[sessionId] = new List<ProfilerEvent>();
|
||||
}
|
||||
AllEvents[sessionId].AddRange(events);
|
||||
}
|
||||
|
||||
public void SessionStopped(string viewerId, int sessionId)
|
||||
public void SessionStopped(string viewerId, SessionId sessionId, string errorMessage)
|
||||
{
|
||||
Stopped = true;
|
||||
StoppedSessions.Add(viewerId);
|
||||
ErrorMessages.Add(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +201,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler
|
||||
|
||||
|
||||
|
||||
public int Id { get { return 51; } }
|
||||
public SessionId Id { get { return new SessionId("testsession_51"); } }
|
||||
|
||||
public void Start(){}
|
||||
|
||||
@@ -282,7 +286,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler
|
||||
" </event>" +
|
||||
"</RingBufferTarget>";
|
||||
|
||||
public int Id { get { return 1; } }
|
||||
public SessionId Id { get { return new SessionId("testsession_1"); } }
|
||||
|
||||
public void Start(){}
|
||||
|
||||
@@ -373,7 +377,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler
|
||||
" </event>" +
|
||||
"</RingBufferTarget>";
|
||||
|
||||
public int Id { get { return 2; } }
|
||||
public SessionId Id { get { return new SessionId("testsession_2"); } }
|
||||
|
||||
public void Start(){}
|
||||
|
||||
@@ -420,5 +424,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler
|
||||
return new TestXEventSession2();
|
||||
}
|
||||
}
|
||||
|
||||
public IXEventSession OpenLocalFileSession(string filePath)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user