Skip to content

Commit

Permalink
Fixes related to loading widget scripts (#10459)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Jun 16, 2022
1 parent 3c3fb96 commit 4ed91b2
Show file tree
Hide file tree
Showing 68 changed files with 118,068 additions and 2,258 deletions.
133 changes: 121 additions & 12 deletions TELEMETRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5842,6 +5842,37 @@ No properties for event

```

</details>
<details>
<summary>DS_INTERNAL.IPYWIDGET_DISCOVER_WIDGETS_NB_EXTENSIONS</summary>

## Description




Total time taken to discover all IPyWidgets.
This is how long it takes to discover all widgets on disc (from python environment).

## Properties


No properties for event


## Locations Used

[src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts)
```typescript
delete config['@jupyter-widgets/controls'];
delete config['@jupyter-widgets/output'];
}
sendTelemetryEvent(Telemetry.DiscoverIPyWidgetNamesPerf, stopWatch.elapsedTime, {
type: isLocalConnection(this.kernel.kernelConnectionMetadata) ? 'local' : 'remote'
});
return config && Object.keys(config).length ? config : undefined;
```

</details>
<details>
<summary>DS_INTERNAL.IPYWIDGET_DISCOVERED</summary>
Expand Down Expand Up @@ -5884,7 +5915,7 @@ No properties for event

[src/kernels/ipywidgets-message-coordination/ipyWidgetScriptSource.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/ipyWidgetScriptSource.ts)
```typescript
widgetSource = await this.scriptProvider.getWidgetScriptSource(moduleName, moduleVersion);
}
} catch (ex) {
traceError('Failed to get widget source due to an error', ex);
sendTelemetryEvent(Telemetry.HashedIPyWidgetScriptDiscoveryError);
Expand All @@ -5893,6 +5924,73 @@ No properties for event
`${ConsoleForegroundColors.Green}Script for ${moduleName}, is ${widgetSource.scriptUri} from ${widgetSource.source}`
```

</details>
<details>
<summary>DS_INTERNAL.IPYWIDGET_EXTENSIONJS_INFO</summary>

## Description




Telemetry event sent once we've successfully or unsuccessfully parsed the extension.js file in the widget folder.
E.g. if we have a widget named ipyvolume, we attempt to parse the nbextensions/ipyvolume/extension.js file to get some info out of it.

## Properties


No properties for event


## Locations Used

[src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts)
```typescript
}

if (indexOfRequireConfig < 0) {
sendTelemetryEvent(Telemetry.IPyWidgetExtensionJsInfo, undefined, {
widgetFolderNameHash,
failed: true,
patternUsedToRegisterRequireConfig,
```


[src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts)
```typescript
// Find the end bracket for the require config call.
const endBracket = contents.indexOf(')', indexOfRequireConfig);
if (endBracket <= 0 || !patternUsedToRegisterRequireConfig) {
sendTelemetryEvent(Telemetry.IPyWidgetExtensionJsInfo, undefined, {
widgetFolderNameHash,
failed: true,
patternUsedToRegisterRequireConfig,
```


[src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts)
```typescript
});

if (!requireConfig || !Object.keys(requireConfig).length) {
sendTelemetryEvent(Telemetry.IPyWidgetExtensionJsInfo, undefined, {
widgetFolderNameHash,
failed: true,
patternUsedToRegisterRequireConfig,
```


[src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/baseIPyWidgetScriptManager.ts)
```typescript
});
return;
}
sendTelemetryEvent(Telemetry.IPyWidgetExtensionJsInfo, undefined, {
widgetFolderNameHash,
patternUsedToRegisterRequireConfig,
requireEntryPointCount: Object.keys(requireConfig).length
```

</details>
<details>
<summary>DS_INTERNAL.IPYWIDGET_LOAD_DISABLED</summary>
Expand Down Expand Up @@ -6024,7 +6122,7 @@ No properties for event

## Locations Used

[src/kernels/ipywidgets-message-coordination/ipyWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/ipyWidgetScriptSourceProvider.ts)
[src/kernels/ipywidgets-message-coordination/cdnWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/cdnWidgetScriptSourceProvider.ts)
```typescript
return this.configurationPromise.promise;
}
Expand Down Expand Up @@ -6054,7 +6152,7 @@ No properties for event

## Locations Used

[src/kernels/ipywidgets-message-coordination/ipyWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/ipyWidgetScriptSourceProvider.ts)
[src/kernels/ipywidgets-message-coordination/cdnWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/cdnWidgetScriptSourceProvider.ts)
```typescript
break;
}
Expand Down Expand Up @@ -6118,15 +6216,14 @@ Event can be removed. Not referenced anywhere

</details>
<details>
<summary>DS_INTERNAL.IPYWIDGET_TEST_AVAILABILITY_ON_LOCAL</summary>
<summary>DS_INTERNAL.IPYWIDGET_TIME_TO_COPY_NBEXTENSIONS_DIR</summary>

## Description




Total time taken to discover all IPyWidgets on disc.
This is how long it takes to discover a single widget on disc (from python environment).
Total time take to copy the nb extensions folder.

## Properties

Expand All @@ -6136,15 +6233,27 @@ No properties for event

## Locations Used

[src/kernels/ipywidgets-message-coordination/localWidgetScriptSourceProvider.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/localWidgetScriptSourceProvider.node.ts)
[src/kernels/ipywidgets-message-coordination/localIPyWidgetScriptManager.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/localIPyWidgetScriptManager.node.ts)
```typescript
LocalIPyWidgetScriptManager.nbExtensionsCopiedKernelConnectionList.add(
this.kernel.kernelConnectionMetadata.id
);
sendTelemetryEvent(Telemetry.IPyWidgetNbExtensionCopyTime, stopWatch.elapsedTime);
return baseUrl;
} catch (ex) {
sendTelemetryEvent(Telemetry.IPyWidgetNbExtensionCopyTime, undefined, undefined, ex);
```


[src/kernels/ipywidgets-message-coordination/localIPyWidgetScriptManager.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets-message-coordination/localIPyWidgetScriptManager.node.ts)
```typescript
sendTelemetryEvent(Telemetry.IPyWidgetNbExtensionCopyTime, stopWatch.elapsedTime);
return baseUrl;
} catch (ex) {
sendTelemetryEvent(Telemetry.IPyWidgetNbExtensionCopyTime, undefined, undefined, ex);
throw ex;
}
return (this.cachedWidgetScripts = this.getWidgetScriptSourcesWithoutCache());
}
@captureTelemetry(Telemetry.DiscoverIPyWidgetNamesLocalPerf)
private async getWidgetScriptSourcesWithoutCache(): Promise<WidgetScriptSource[]> {
const sysPrefix = await this.getSysPrefixOfKernel();
if (!sysPrefix) {
```

</details>
Expand Down
1 change: 1 addition & 0 deletions news/1 Enhancements/8834.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure static resources required by IPyWidgets get downloaded appropriately in the Web and when using local or remote Jupyter Servers.
1 change: 1 addition & 0 deletions news/2 Fixes/10060.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure IPyWidgets get loaded correctly when loading resources from the CDN, Remote Jupyter or local the Python Environment.
Loading

0 comments on commit 4ed91b2

Please sign in to comment.