add logging to help troubleshoot delegation errors (#15928)

* add logging to help troubleshoot delegation errors

* change property

* lint

* telemetry update
This commit is contained in:
Aaron Munger 2024-08-08 14:10:13 -07:00 коммит произвёл GitHub
Родитель 1515b12e82
Коммит 109457dfa8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
5 изменённых файлов: 47 добавлений и 10 удалений

Просмотреть файл

@ -386,6 +386,8 @@
// Failed to show the data viewer via the variable view.
/* __GDPR__
"DATASCIENCE.FAILED_SHOW_DATA_EXPLORER" : {
"reason": {"classification":"SystemMetaData","purpose":"FeatureInsight","comment":"","owner":"amunger"},
"fromVariableView": {"classification":"SystemMetaData","purpose":"FeatureInsight","comment":"","owner":"amunger"},
"${include}": [
"${F1}"

Просмотреть файл

@ -1785,15 +1785,28 @@ export class IEventNamePropertyMapping {
/**
* Failed to show the data viewer via the variable view.
*/
[Telemetry.FailedShowDataViewer]: TelemetryEventInfo<never | undefined> = {
owner: 'IanMatthewHuff',
[Telemetry.FailedShowDataViewer]: TelemetryEventInfo<{
reason: string;
fromVariableView: boolean;
}> = {
owner: 'amunger',
feature: ['DataFrameViewer', 'VariableViewer'],
source: 'N/A'
source: 'N/A',
properties: {
reason: {
classification: 'SystemMetaData',
purpose: 'FeatureInsight'
},
fromVariableView: {
classification: 'SystemMetaData',
purpose: 'FeatureInsight'
}
}
};
/**
* Sent when the jupyter.refreshDataViewer command is invoked
*/
[Telemetry.RefreshDataViewer]: TelemetryEventInfo<never | undefined> = {
[Telemetry.RefreshDataViewer]: TelemetryEventInfo<undefined | never> = {
owner: 'IanMatthewHuff',
feature: ['DataFrameViewer'],
source: 'User Action'

Просмотреть файл

@ -49,9 +49,8 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic
private readonly jupyterVariableDataProviderFactory: IJupyterVariableDataProviderFactory | undefined,
@inject(IDataViewerFactory) @optional() private readonly dataViewerFactory: IDataViewerFactory | undefined,
@inject(IJupyterVariables)
@optional()
@named(Identifiers.DEBUGGER_VARIABLES)
private variableProvider: IJupyterVariables | undefined,
private variableProvider: IJupyterVariables,
@inject(IDataScienceErrorHandler) private readonly errorHandler: IDataScienceErrorHandler,
@inject(IDataViewerDependencyService)
@optional()
@ -91,9 +90,14 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic
private async delegateDataViewer(request: IJupyterVariable | IShowDataViewerFromVariablePanel) {
const variable = 'variable' in request ? await this.getVariableFromRequest(request) : request;
if (!variable) {
logger.error('Full variable info could not be retreived');
sendTelemetryEvent(Telemetry.FailedShowDataViewer, undefined, {
reason: 'no variable info',
fromVariableView: false
});
return;
}
return this.dataViewerDelegator.showContributedDataViewer(variable);
return this.dataViewerDelegator.showContributedDataViewer(variable, false);
}
// get the information needed about the request from the debug variable view

Просмотреть файл

@ -13,7 +13,7 @@ import * as localize from '../../../platform/common/utils/localize';
@injectable()
export class DataViewerDelegator {
public async showContributedDataViewer(variable: IJupyterVariable) {
public async showContributedDataViewer(variable: IJupyterVariable, fromVariableView: boolean) {
try {
// jupyterVariableViewers
const variableViewers = this.getMatchingExternalVariableViewers(variable);
@ -34,11 +34,23 @@ export class DataViewerDelegator {
});
} else if (variableViewers.length === 1) {
const command = variableViewers[0].jupyterVariableViewers.command;
logger.info(
`Showing data viewer with command ${command} for variable ${JSON.stringify({
...variable,
value: '...'
})}`
);
return commands.executeCommand(command, variable);
} else {
const thirdPartyViewers = variableViewers.filter((d) => d.extension.id !== JVSC_EXTENSION_ID);
if (thirdPartyViewers.length === 1) {
const command = thirdPartyViewers[0].jupyterVariableViewers.command;
logger.info(
`Showing data viewer viewer with command ${command} for variable ${JSON.stringify({
...variable,
value: '...'
})}`
);
return commands.executeCommand(command, variable);
}
// show quick pick
@ -55,6 +67,12 @@ export class DataViewerDelegator {
const item = quickPick.selectedItems[0];
if (item) {
quickPick.hide();
logger.info(
`Showing data viewer viewer with command ${item.command} for variable ${JSON.stringify({
...variable,
value: '...'
})}`
);
return commands.executeCommand(item.command, variable);
}
});
@ -62,7 +80,7 @@ export class DataViewerDelegator {
}
} catch (e) {
logger.error(e);
sendTelemetryEvent(Telemetry.FailedShowDataViewer);
sendTelemetryEvent(Telemetry.FailedShowDataViewer, undefined, { reason: 'exception', fromVariableView });
window.showErrorMessage(localize.DataScience.showDataViewerFail).then(noop, noop);
}
}

Просмотреть файл

@ -133,7 +133,7 @@ export class VariableView extends WebviewViewHost<IVariableViewPanelMapping> imp
@swallowExceptions()
public async showDataViewer(request: IShowDataViewer) {
request.variable.fileName = request.variable.fileName ?? this.notebookWatcher.activeKernel?.notebook.uri;
return this.dataViewerDelegator.showContributedDataViewer(request.variable);
return this.dataViewerDelegator.showContributedDataViewer(request.variable, true);
}
private postProcessSupportsDataExplorer(response: IJupyterVariablesResponse) {