Add session templates to profiler (#2115)

* Initial support for handling available sessions

* Displaying sessions in drop down, send session name in start profiling request

* More support for starting existing sessions

* New session dialog and session templates in user files

* Create profiler dialog and session templates

* Preliminary session template changes

* Saving some changes

* Send session templates when creating sessions

* Saving changes

* UI Fixes for dialog

* Formatting fixes

* removing comments

* Fixing PR comments

* bumping toolsservice and dataprotocolclient versions

* Fixing starting existing sessions
This commit is contained in:
Madeline MacDonald
2018-08-03 15:24:50 -07:00
committed by GitHub
parent 2a650d4d74
commit 79269cdfd5
22 changed files with 780 additions and 261 deletions

View File

@@ -497,11 +497,18 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
* Profiler Provider methods
*/
/**
* Create a new profiler session
*/
public $createSession(handle: number, sessionId: string, createStatement: string, template: sqlops.ProfilerSessionTemplate): Thenable<boolean> {
return this._resolveProvider<sqlops.ProfilerProvider>(handle).createSession(sessionId, createStatement, template);
}
/**
* Start a profiler session
*/
public $startSession(handle: number, sessionId: string): Thenable<boolean> {
return this._resolveProvider<sqlops.ProfilerProvider>(handle).startSession(sessionId);
public $startSession(handle: number, sessionId: string, sessionName: string): Thenable<boolean> {
return this._resolveProvider<sqlops.ProfilerProvider>(handle).startSession(sessionId, sessionName);
}
/**
@@ -518,6 +525,12 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
return this._resolveProvider<sqlops.ProfilerProvider>(handle).pauseSession(sessionId);
}
/**
* Get list of running XEvent sessions on the session's target server
*/
public $getXEventSessions(handle: number, sessionId: string): Thenable<string[]> {
return this._resolveProvider<sqlops.ProfilerProvider>(handle).getXEventSessions(sessionId);
}
/**
* Profiler session events available notification
@@ -533,6 +546,13 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
this._proxy.$onSessionStopped(handle, response);
}
/**
* Profiler session created notification
*/
public $onProfilerSessionCreated(handle: number, response: sqlops.ProfilerSessionCreatedParams): void {
this._proxy.$onProfilerSessionCreated(handle, response);
}
/**
* Agent Job Provider methods

View File

@@ -295,8 +295,11 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
public $registerProfilerProvider(providerId: string, handle: number): TPromise<any> {
const self = this;
this._profilerService.registerProvider(providerId, <sqlops.ProfilerProvider>{
startSession(sessionId: string): Thenable<boolean> {
return self._proxy.$startSession(handle, sessionId);
createSession(sessionId: string, createStatement: string, template: sqlops.ProfilerSessionTemplate): Thenable<boolean> {
return self._proxy.$createSession(handle, sessionId, createStatement, template);
},
startSession(sessionId: string, sessionName: string): Thenable<boolean> {
return self._proxy.$startSession(handle, sessionId, sessionName);
},
stopSession(sessionId: string): Thenable<boolean> {
return self._proxy.$stopSession(handle, sessionId);
@@ -304,6 +307,9 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
pauseSession(sessionId: string): Thenable<boolean> {
return self._proxy.$pauseSession(handle, sessionId);
},
getXEventSessions(sessionId: string): Thenable<string[]> {
return self._proxy.$getXEventSessions(handle, sessionId);
},
connectSession(sessionId: string): Thenable<boolean> {
return TPromise.as(true);
},
@@ -466,6 +472,10 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
this._profilerService.onSessionStopped(response);
}
public $onProfilerSessionCreated(handle: number, response: sqlops.ProfilerSessionCreatedParams): void {
this._profilerService.onProfilerSessionCreated(response);
}
// SQL Server Agent handlers
public $onJobDataUpdated(handle: Number): void {
this._jobManagementService.fireOnDidChange();

View File

@@ -254,6 +254,10 @@ export function createApiFactory(
extHostDataProvider.$onSessionStopped(provider.handle, response);
});
provider.registerOnProfilerSessionCreated((response: sqlops.ProfilerSessionCreatedParams) => {
extHostDataProvider.$onProfilerSessionCreated(provider.handle, response);
});
return extHostDataProvider.$registerProfilerProvider(provider);
};

View File

@@ -315,10 +315,15 @@ export abstract class ExtHostDataProtocolShape {
* Profiler Provider methods
*/
/**
* Create a profiler session
*/
$createSession(handle: number, sessionId: string, createStatement: string, template: sqlops.ProfilerSessionTemplate): Thenable<boolean> { throw ni(); }
/**
* Start a profiler session
*/
$startSession(handle: number, sessionId: string): Thenable<boolean> { throw ni(); }
$startSession(handle: number, sessionId: string, sessionName: string): Thenable<boolean> { throw ni(); }
/**
* Stop a profiler session
@@ -330,6 +335,10 @@ export abstract class ExtHostDataProtocolShape {
*/
$pauseSession(handle: number, sessionId: string): Thenable<boolean> { throw ni(); }
/**
* Get list of running XEvent sessions on the profiler session's target server
*/
$getXEventSessions(handle: number, sessionId: string): Thenable<string[]> { throw ni(); }
/**
* Get Agent Job list
@@ -469,6 +478,7 @@ export interface MainThreadDataProtocolShape extends IDisposable {
$onScriptingComplete(handle: number, message: sqlops.ScriptingCompleteResult): void;
$onSessionEventsAvailable(handle: number, response: sqlops.ProfilerSessionEvents): void;
$onSessionStopped(handle: number, response: sqlops.ProfilerSessionStoppedParams): void;
$onProfilerSessionCreated(handle: number, response: sqlops.ProfilerSessionCreatedParams): void;
$onJobDataUpdated(handle: Number): void;
/**