mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Profiler notifications (#1648)
* adding lost events flag to events available notification * Initial changes to support notifications for stopped session and lost events * Updated localized strings & send stop notification box * reordering imports * vbump sqltools & dataprotocolclient, fix notification wording
This commit is contained in:
committed by
GitHub
parent
e686fed209
commit
520cfb780a
@@ -658,7 +658,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.1.8.2",
|
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.1.9",
|
||||||
"opener": "^1.4.3",
|
"opener": "^1.4.3",
|
||||||
"service-downloader": "github:anthonydresser/service-downloader#0.1.2",
|
"service-downloader": "github:anthonydresser/service-downloader#0.1.2",
|
||||||
"vscode-extension-telemetry": "^0.0.15"
|
"vscode-extension-telemetry": "^0.0.15"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||||
"version": "1.4.0-alpha.45",
|
"version": "1.4.0-alpha.46",
|
||||||
"downloadFileNames": {
|
"downloadFileNames": {
|
||||||
"Windows_86": "win-x86-netcoreapp2.1.zip",
|
"Windows_86": "win-x86-netcoreapp2.1.zip",
|
||||||
"Windows_64": "win-x64-netcoreapp2.1.zip",
|
"Windows_64": "win-x64-netcoreapp2.1.zip",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
|||||||
import { EditorInput } from 'vs/workbench/common/editor';
|
import { EditorInput } from 'vs/workbench/common/editor';
|
||||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
import { Event, Emitter } from 'vs/base/common/event';
|
import { Event, Emitter } from 'vs/base/common/event';
|
||||||
import { generateUuid } from 'vs/base/common/uuid';
|
import { generateUuid } from 'vs/base/common/uuid';
|
||||||
|
|
||||||
@@ -35,7 +36,8 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
|
|||||||
constructor(
|
constructor(
|
||||||
private _connection: IConnectionProfile,
|
private _connection: IConnectionProfile,
|
||||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||||
@IProfilerService private _profilerService: IProfilerService
|
@IProfilerService private _profilerService: IProfilerService,
|
||||||
|
@INotificationService private _notificationService: INotificationService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._state = new ProfilerState();
|
this._state = new ProfilerState();
|
||||||
@@ -123,7 +125,21 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
|
|||||||
return this._state;
|
return this._state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onSessionStopped(notification: sqlops.ProfilerSessionStoppedParams) {
|
||||||
|
this._notificationService.error(nls.localize("profiler.sessionStopped", "XEvent Profiler Session stopped unexpectedly on the server {0}.", this._connection.serverName));
|
||||||
|
|
||||||
|
this.state.change({
|
||||||
|
isStopped: true,
|
||||||
|
isPaused: false,
|
||||||
|
isRunning: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public onMoreRows(eventMessage: sqlops.ProfilerSessionEvents) {
|
public onMoreRows(eventMessage: sqlops.ProfilerSessionEvents) {
|
||||||
|
if (eventMessage.eventsLost){
|
||||||
|
this._notificationService.warn(nls.localize("profiler.eventsLost", "The XEvent Profiler session for {0} has lost events.", this._connection.serverName));
|
||||||
|
}
|
||||||
|
|
||||||
for (let i: number = 0; i < eventMessage.events.length && i < 500; ++i) {
|
for (let i: number = 0; i < eventMessage.events.length && i < 500; ++i) {
|
||||||
let e: sqlops.ProfilerEvent = eventMessage.events[i];
|
let e: sqlops.ProfilerEvent = eventMessage.events[i];
|
||||||
let data = {};
|
let data = {};
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ export interface IProfilerSession {
|
|||||||
* Called by the service when more rows are available to render
|
* Called by the service when more rows are available to render
|
||||||
*/
|
*/
|
||||||
onMoreRows(events: sqlops.ProfilerSessionEvents);
|
onMoreRows(events: sqlops.ProfilerSessionEvents);
|
||||||
|
/**
|
||||||
|
* Called by the service when the session is closed unexpectedly
|
||||||
|
*/
|
||||||
|
onSessionStopped(events: sqlops.ProfilerSessionStoppedParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,6 +69,10 @@ export interface IProfilerService {
|
|||||||
* The method called by the service provider for when more rows are available to render
|
* The method called by the service provider for when more rows are available to render
|
||||||
*/
|
*/
|
||||||
onMoreRows(params: sqlops.ProfilerSessionEvents): void;
|
onMoreRows(params: sqlops.ProfilerSessionEvents): void;
|
||||||
|
/**
|
||||||
|
* The method called by the service provider for when more rows are available to render
|
||||||
|
*/
|
||||||
|
onSessionStopped(params: sqlops.ProfilerSessionStoppedParams): void;
|
||||||
/**
|
/**
|
||||||
* Gets a list of the session templates that are specified in the settings
|
* Gets a list of the session templates that are specified in the settings
|
||||||
* @param provider An optional string to limit the session template to a specific
|
* @param provider An optional string to limit the session template to a specific
|
||||||
|
|||||||
@@ -82,6 +82,11 @@ export class ProfilerService implements IProfilerService {
|
|||||||
this._sessionMap.get(this._idMap.reverseGet(params.sessionId)).onMoreRows(params);
|
this._sessionMap.get(this._idMap.reverseGet(params.sessionId)).onMoreRows(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onSessionStopped(params: sqlops.ProfilerSessionStoppedParams): void {
|
||||||
|
|
||||||
|
this._sessionMap.get(this._idMap.reverseGet(params.ownerUri)).onSessionStopped(params);
|
||||||
|
}
|
||||||
|
|
||||||
public connectSession(id: ProfilerSessionID): Thenable<boolean> {
|
public connectSession(id: ProfilerSessionID): Thenable<boolean> {
|
||||||
return this._runAction(id, provider => provider.connectSession(this._idMap.get(id)));
|
return this._runAction(id, provider => provider.connectSession(this._idMap.get(id)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ export class ProfilerTestBackend implements sqlops.ProfilerProvider {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registerOnSessionStopped(handler: (response: sqlops.ProfilerSessionStoppedParams) => any) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
private intervalFn(guid: string): number {
|
private intervalFn(guid: string): number {
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
let data = this.testData[this.index++];
|
let data = this.testData[this.index++];
|
||||||
|
|||||||
10
src/sql/sqlops.d.ts
vendored
10
src/sql/sqlops.d.ts
vendored
@@ -1409,6 +1409,7 @@ declare module 'sqlops' {
|
|||||||
disconnectSession(sessionId: string): Thenable<boolean>;
|
disconnectSession(sessionId: string): Thenable<boolean>;
|
||||||
|
|
||||||
registerOnSessionEventsAvailable(handler: (response: ProfilerSessionEvents) => any): void;
|
registerOnSessionEventsAvailable(handler: (response: ProfilerSessionEvents) => any): void;
|
||||||
|
registerOnSessionStopped(handler: (response: ProfilerSessionStoppedParams) => any): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProfilerTableRow {
|
export interface IProfilerTableRow {
|
||||||
@@ -1449,6 +1450,15 @@ declare module 'sqlops' {
|
|||||||
sessionId: string;
|
sessionId: string;
|
||||||
|
|
||||||
events: ProfilerEvent[];
|
events: ProfilerEvent[];
|
||||||
|
|
||||||
|
eventsLost: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProfilerSessionStoppedParams {
|
||||||
|
|
||||||
|
ownerUri: string;
|
||||||
|
|
||||||
|
sessionId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// File browser interfaces -----------------------------------------------------------------------
|
// File browser interfaces -----------------------------------------------------------------------
|
||||||
|
|||||||
@@ -518,6 +518,13 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
|||||||
this._proxy.$onSessionEventsAvailable(handle, response);
|
this._proxy.$onSessionEventsAvailable(handle, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Profiler session stopped unexpectedly notification
|
||||||
|
*/
|
||||||
|
public $onSessionStopped(handle: number, response: sqlops.ProfilerSessionStoppedParams): void {
|
||||||
|
this._proxy.$onSessionStopped(handle, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agent Job Provider methods
|
* Agent Job Provider methods
|
||||||
|
|||||||
@@ -432,6 +432,10 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
|
|||||||
this._profilerService.onMoreRows(response);
|
this._profilerService.onMoreRows(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public $onSessionStopped(handle: number, response: sqlops.ProfilerSessionStoppedParams): void {
|
||||||
|
this._profilerService.onSessionStopped(response);
|
||||||
|
}
|
||||||
|
|
||||||
public $unregisterProvider(handle: number): TPromise<any> {
|
public $unregisterProvider(handle: number): TPromise<any> {
|
||||||
let capabilitiesRegistration = this._capabilitiesRegistrations[handle];
|
let capabilitiesRegistration = this._capabilitiesRegistrations[handle];
|
||||||
if (capabilitiesRegistration) {
|
if (capabilitiesRegistration) {
|
||||||
|
|||||||
@@ -237,6 +237,10 @@ export function createApiFactory(
|
|||||||
extHostDataProvider.$onSessionEventsAvailable(provider.handle, response);
|
extHostDataProvider.$onSessionEventsAvailable(provider.handle, response);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
provider.registerOnSessionStopped((response: sqlops.ProfilerSessionStoppedParams) => {
|
||||||
|
extHostDataProvider.$onSessionStopped(provider.handle, response);
|
||||||
|
});
|
||||||
|
|
||||||
return extHostDataProvider.$registerProfilerProvider(provider);
|
return extHostDataProvider.$registerProfilerProvider(provider);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ export interface MainThreadDataProtocolShape extends IDisposable {
|
|||||||
$onFilePathsValidated(handle: number, response: sqlops.FileBrowserValidatedParams): void;
|
$onFilePathsValidated(handle: number, response: sqlops.FileBrowserValidatedParams): void;
|
||||||
$onScriptingComplete(handle: number, message: sqlops.ScriptingCompleteResult): void;
|
$onScriptingComplete(handle: number, message: sqlops.ScriptingCompleteResult): void;
|
||||||
$onSessionEventsAvailable(handle: number, response: sqlops.ProfilerSessionEvents): void;
|
$onSessionEventsAvailable(handle: number, response: sqlops.ProfilerSessionEvents): void;
|
||||||
|
$onSessionStopped(handle: number, response: sqlops.ProfilerSessionStoppedParams): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback when a session has completed initialization
|
* Callback when a session has completed initialization
|
||||||
|
|||||||
Reference in New Issue
Block a user