Stopping sessions when handling stop requests (#627)

* Dropping profiler session on stop request

* Changes to IXEventSession to simplify dropping sessions

* Stop sessions instead of dropping, disable flaky tests
This commit is contained in:
Madeline MacDonald
2018-06-05 13:48:55 -07:00
committed by GitHub
parent b41c19bd25
commit 35b19320d4
9 changed files with 235 additions and 161 deletions

View File

@@ -50,148 +50,150 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler
public class TestXEventSession : IXEventSession
{
private string testXEventXml =
"<RingBufferTarget truncated=\"0\" processingTime=\"3\" totalEventsProcessed=\"1\" eventCount=\"1\" droppedCount=\"0\" memoryUsed=\"47996\">" +
" <event name=\"existing_connection\" package=\"sqlserver\" timestamp=\"2017-09-08T07:46:53.579Z\">" +
" <data name=\"session_id\">" +
" <type name=\"int16\" package=\"package0\"></type>" +
" <value>51</value>" +
" </data>" +
" <data name=\"is_dac\">" +
" <type name=\"boolean\" package=\"package0\"></type>" +
" <value>false</value>" +
" </data>" +
" <data name=\"database_id\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>1</value>" +
" </data>" +
" <data name=\"packet_size\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>4096</value>" +
" </data>" +
" <data name=\"transaction_count\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>0</value>" +
" </data>" +
" <data name=\"group_id\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>2</value>" +
" </data>" +
" <data name=\"duration\">" +
" <type name=\"uint64\" package=\"package0\"></type>" +
" <value>191053000</value>" +
" </data>" +
" <data name=\"client_pid\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>4680</value>" +
" </data>" +
" <data name=\"options\">" +
" <type name=\"binary_data\" package=\"package0\"></type>" +
" <value>2000002838f4010000000000</value>" +
" </data>" +
" <data name=\"options_text\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value>" +
" <![CDATA[-- network protocol: LPC" +
"set quoted_identifier on" +
"set arithabort off" +
"set numeric_roundabort off" +
"set ansi_warnings on" +
"set ansi_padding on" +
"set ansi_nulls on" +
"set concat_null_yields_null on" +
"set cursor_close_on_commit off" +
"set implicit_transactions off" +
"set language us_english" +
"set dateformat mdy" +
"set datefirst 7" +
"set transaction isolation level read committed" +
"]]>" +
" </value>" +
" </data>" +
" <data name=\"started_event_session_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[Profiler]]></value>" +
" </data>" +
" <data name=\"database_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"client_app_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[Microsoft SQL Server Management Studio]]></value>" +
" </data>" +
" <data name=\"client_hostname\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[KARLBURTRAMC189]]></value>" +
" </data>" +
" <data name=\"nt_domain\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"nt_user\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"session_nt_domain\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"session_nt_user\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"server_principal_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[sa]]></value>" +
" </data>" +
" <data name=\"server_principal_sid\">" +
" <type name=\"binary_data\" package=\"package0\"></type>" +
" <value>01</value>" +
" </data>" +
" <data name=\"session_server_principal_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[sa]]></value>" +
" </data>" +
" <data name=\"session_server_principal_sid\">" +
" <type name=\"binary_data\" package=\"package0\"></type>" +
" <value>01</value>" +
" </data>" +
" <action name=\"session_id\" package=\"sqlserver\">" +
" <type name=\"uint16\" package=\"package0\"></type>" +
" <value>56</value>" +
" </action>" +
" <action name=\"server_principal_name\" package=\"sqlserver\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[sa]]></value>" +
" </action>" +
" <action name=\"nt_username\" package=\"sqlserver\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </action>" +
" <action name=\"client_pid\" package=\"sqlserver\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>930958063</value>" +
" </action>" +
" <action name=\"client_app_name\" package=\"sqlserver\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[Core .Net SqlClient Data Provider]]></value>" +
" </action>" +
" <action name=\"attach_activity_id_xfer\" package=\"package0\">" +
" <type name=\"activity_id_xfer\" package=\"package0\"></type>" +
" <value>A2873402-C433-4D1F-94C4-9CA99749453E-0</value>" +
" </action>" +
" <action name=\"attach_activity_id\" package=\"package0\">" +
" <type name=\"activity_id\" package=\"package0\"></type>" +
" <value>770C3538-EC3F-4A27-86A9-31A2FC777DBC-1</value>" +
" </action>" +
" </event>" +
private string testXEventXml =
"<RingBufferTarget truncated=\"0\" processingTime=\"3\" totalEventsProcessed=\"1\" eventCount=\"1\" droppedCount=\"0\" memoryUsed=\"47996\">" +
" <event name=\"existing_connection\" package=\"sqlserver\" timestamp=\"2017-09-08T07:46:53.579Z\">" +
" <data name=\"session_id\">" +
" <type name=\"int16\" package=\"package0\"></type>" +
" <value>51</value>" +
" </data>" +
" <data name=\"is_dac\">" +
" <type name=\"boolean\" package=\"package0\"></type>" +
" <value>false</value>" +
" </data>" +
" <data name=\"database_id\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>1</value>" +
" </data>" +
" <data name=\"packet_size\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>4096</value>" +
" </data>" +
" <data name=\"transaction_count\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>0</value>" +
" </data>" +
" <data name=\"group_id\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>2</value>" +
" </data>" +
" <data name=\"duration\">" +
" <type name=\"uint64\" package=\"package0\"></type>" +
" <value>191053000</value>" +
" </data>" +
" <data name=\"client_pid\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>4680</value>" +
" </data>" +
" <data name=\"options\">" +
" <type name=\"binary_data\" package=\"package0\"></type>" +
" <value>2000002838f4010000000000</value>" +
" </data>" +
" <data name=\"options_text\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value>" +
" <![CDATA[-- network protocol: LPC" +
"set quoted_identifier on" +
"set arithabort off" +
"set numeric_roundabort off" +
"set ansi_warnings on" +
"set ansi_padding on" +
"set ansi_nulls on" +
"set concat_null_yields_null on" +
"set cursor_close_on_commit off" +
"set implicit_transactions off" +
"set language us_english" +
"set dateformat mdy" +
"set datefirst 7" +
"set transaction isolation level read committed" +
"]]>" +
" </value>" +
" </data>" +
" <data name=\"started_event_session_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[Profiler]]></value>" +
" </data>" +
" <data name=\"database_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"client_app_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[Microsoft SQL Server Management Studio]]></value>" +
" </data>" +
" <data name=\"client_hostname\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[KARLBURTRAMC189]]></value>" +
" </data>" +
" <data name=\"nt_domain\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"nt_user\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"session_nt_domain\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"session_nt_user\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </data>" +
" <data name=\"server_principal_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[sa]]></value>" +
" </data>" +
" <data name=\"server_principal_sid\">" +
" <type name=\"binary_data\" package=\"package0\"></type>" +
" <value>01</value>" +
" </data>" +
" <data name=\"session_server_principal_name\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[sa]]></value>" +
" </data>" +
" <data name=\"session_server_principal_sid\">" +
" <type name=\"binary_data\" package=\"package0\"></type>" +
" <value>01</value>" +
" </data>" +
" <action name=\"session_id\" package=\"sqlserver\">" +
" <type name=\"uint16\" package=\"package0\"></type>" +
" <value>56</value>" +
" </action>" +
" <action name=\"server_principal_name\" package=\"sqlserver\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[sa]]></value>" +
" </action>" +
" <action name=\"nt_username\" package=\"sqlserver\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[]]></value>" +
" </action>" +
" <action name=\"client_pid\" package=\"sqlserver\">" +
" <type name=\"uint32\" package=\"package0\"></type>" +
" <value>930958063</value>" +
" </action>" +
" <action name=\"client_app_name\" package=\"sqlserver\">" +
" <type name=\"unicode_string\" package=\"package0\"></type>" +
" <value><![CDATA[Core .Net SqlClient Data Provider]]></value>" +
" </action>" +
" <action name=\"attach_activity_id_xfer\" package=\"package0\">" +
" <type name=\"activity_id_xfer\" package=\"package0\"></type>" +
" <value>A2873402-C433-4D1F-94C4-9CA99749453E-0</value>" +
" </action>" +
" <action name=\"attach_activity_id\" package=\"package0\">" +
" <type name=\"activity_id\" package=\"package0\"></type>" +
" <value>770C3538-EC3F-4A27-86A9-31A2FC777DBC-1</value>" +
" </action>" +
" </event>" +
"</RingBufferTarget>";
public string GetTargetXml()
{
return testXEventXml;
}
public void Stop(){}
}
public class TestXEventSessionFactory : IXEventSessionFactory