Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:

- name: Package extension
run: npm run package
env:
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}

- name: Rename VSIX file
run: |
Expand Down
6 changes: 6 additions & 0 deletions build/esbuild/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ function createConfig(
inject.push(path.join(__dirname, isDevbuild ? 'process.development.js' : 'process.production.js'));
}
}
if (target === 'desktop') {
// Bake the PostHog key in from the CI secret at build time; falls back to the placeholder locally (see constants.ts).
define = {
POSTHOG_API_KEY_BUILD: JSON.stringify(process.env.POSTHOG_API_KEY ?? '')
};
}
if (source.endsWith(path.join('data-explorer', 'index.tsx'))) {
inject.push(path.join(__dirname, 'jquery.js'));
}
Expand Down
83 changes: 83 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,12 @@
"description": "Disable SSL certificate verification (for development only)",
"scope": "application"
},
"deepnote.telemetry.enabled": {
"type": "boolean",
"default": true,
"description": "%deepnote.configuration.deepnote.telemetry.enabled.description%",
"scope": "application"
},
Comment thread
tkislan marked this conversation as resolved.
"deepnote.snapshots.enabled": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -2726,6 +2732,7 @@
"pidtree": "^0.6.0",
"plotly.js-dist": "^3.0.1",
"portfinder": "^1.0.25",
"posthog-node": "^4.18.0",
"re-resizable": "^6.5.5",
"react": "^16.5.2",
"react-data-grid": "^6.0.2-0",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"deepnote.debuggers.kernel": "Python Kernel Debug Adapter",
"deepnote.debuggers.interactive": "Python Interactive Window",
"deepnote.configuration.deepnote.experiments.enabled.description": "Enables/disables A/B tests.",
"deepnote.configuration.deepnote.telemetry.enabled.description": "Enable anonymous usage telemetry to help improve Deepnote for VS Code.",
"deepnote.configuration.deepnote.showVariableViewWhenDebugging.description": "Bring up the Variable View when starting a Run by Line session.",
"deepnote.configuration.deepnote.logging.level.off": "No messages are logged with this level.",
"deepnote.configuration.deepnote.logging.level.trace": "All messages are logged with this level.",
Expand Down
1 change: 1 addition & 0 deletions src/extension.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export function deactivate(): Thenable<void> {
// Make sure to shutdown anybody who needs it.
if (activatedServiceContainer) {
const registry = activatedServiceContainer.get<IAsyncDisposableRegistry>(IAsyncDisposableRegistry);

if (registry) {
return registry.dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { IPythonApiProvider } from '../../../platform/api/types';
import { STANDARD_OUTPUT_CHANNEL } from '../../../platform/common/constants';
import { getDisplayPath } from '../../../platform/common/platform/fs-paths.node';
import { ITelemetryService } from '../../../platform/analytics/types';
import { IDisposableRegistry, IOutputChannel } from '../../../platform/common/types';
import { createDeepnoteServerConfigHandle } from '../../../platform/deepnote/deepnoteServerUtils.node';
import { DeepnoteToolkitMissingError } from '../../../platform/errors/deepnoteKernelErrors';
Expand Down Expand Up @@ -54,7 +55,8 @@ export class DeepnoteEnvironmentsView implements Disposable {
private readonly notebookEnvironmentMapper: IDeepnoteNotebookEnvironmentMapper,
@inject(IKernelProvider) private readonly kernelProvider: IKernelProvider,
@inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly outputChannel: IOutputChannel,
@inject(IDeepnoteServerStarter) private readonly serverStarter: IDeepnoteServerStarter
@inject(IDeepnoteServerStarter) private readonly serverStarter: IDeepnoteServerStarter,
@inject(ITelemetryService) private readonly analytics: ITelemetryService
) {
// Create tree data provider

Expand Down Expand Up @@ -195,6 +197,14 @@ export class DeepnoteEnvironmentsView implements Disposable {
const config = await this.environmentManager.createEnvironment(options, token);
logger.info(`Created environment: ${config.id} (${config.name})`);

this.analytics.trackEvent({
eventName: 'create_environment',
properties: {
hasDescription: !!options.description,
hasPackages: !!options.packages?.length
}
});

void window.showInformationMessage(
l10n.t('Environment "{0}" created successfully!', config.name)
);
Expand Down Expand Up @@ -328,6 +338,7 @@ export class DeepnoteEnvironmentsView implements Disposable {
}
);

this.analytics.trackEvent({ eventName: 'delete_environment' });
void window.showInformationMessage(l10n.t('Environment "{0}" deleted', config.name));
} catch (error) {
logger.error('Failed to delete environment', error);
Expand Down Expand Up @@ -494,6 +505,7 @@ export class DeepnoteEnvironmentsView implements Disposable {
}
);

this.analytics.trackEvent({ eventName: 'select_environment' });
void window.showInformationMessage(l10n.t('Environment switched successfully'));
} catch (error) {
if (error instanceof DeepnoteToolkitMissingError) {
Expand Down Expand Up @@ -544,6 +556,7 @@ export class DeepnoteEnvironmentsView implements Disposable {

logger.info(`Renamed environment ${environmentId} to "${newName}"`);
void window.showInformationMessage(l10n.t('Environment renamed to "{0}"', newName));
this.analytics.trackEvent({ eventName: 'update_environment', properties: { field: 'name' } });
} catch (error) {
logger.error('Failed to rename environment', error);
void window.showErrorMessage(l10n.t('Failed to rename environment. See output for details.'));
Expand Down Expand Up @@ -602,6 +615,10 @@ export class DeepnoteEnvironmentsView implements Disposable {
);

void window.showInformationMessage(l10n.t('Packages updated for "{0}"', config.name));
this.analytics.trackEvent({
eventName: 'update_environment',
properties: { field: 'packages', packageCount: packages.length }
});
} catch (error) {
logger.error('Failed to update packages', error);
void window.showErrorMessage(l10n.t('Failed to update packages. See output for details.'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
IDeepnoteServerStarter
} from '../types';
import { IPythonApiProvider } from '../../../platform/api/types';
import { ITelemetryService } from '../../../platform/analytics/types';
import { IDisposableRegistry, IOutputChannel } from '../../../platform/common/types';
import { IKernelProvider } from '../../../kernels/types';
import { DeepnoteEnvironment } from './deepnoteEnvironment';
Expand All @@ -30,6 +31,7 @@ suite('DeepnoteEnvironmentsView', () => {
let mockNotebookEnvironmentMapper: IDeepnoteNotebookEnvironmentMapper;
let mockKernelProvider: IKernelProvider;
let mockOutputChannel: IOutputChannel;
let mockTelemetryService: ITelemetryService;
let mockServerStarter: IDeepnoteServerStarter;
let disposables: Disposable[] = [];
let pythonEnvironments: PythonExtension['environments'];
Expand All @@ -49,6 +51,7 @@ suite('DeepnoteEnvironmentsView', () => {
mockNotebookEnvironmentMapper = mock<IDeepnoteNotebookEnvironmentMapper>();
mockKernelProvider = mock<IKernelProvider>();
mockOutputChannel = mock<IOutputChannel>();
mockTelemetryService = mock<ITelemetryService>();
mockServerStarter = mock<IDeepnoteServerStarter>();

// stopServer is a safe no-op when a notebook has no running server
Expand All @@ -72,7 +75,8 @@ suite('DeepnoteEnvironmentsView', () => {
instance(mockNotebookEnvironmentMapper),
instance(mockKernelProvider),
instance(mockOutputChannel),
instance(mockServerStarter)
instance(mockServerStarter),
instance(mockTelemetryService)
);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});

Expand Down
8 changes: 6 additions & 2 deletions src/notebooks/deepnote/deepnoteActivationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { inject, injectable, optional } from 'inversify';
import { commands, l10n, workspace, window, type Disposable, type NotebookDocumentContentOptions } from 'vscode';

import { IExtensionSyncActivationService } from '../../platform/activation/types';
import { ITelemetryService } from '../../platform/analytics/types';
import { IExtensionContext } from '../../platform/common/types';
import { ILogger } from '../../platform/logging/types';
import { IDeepnoteNotebookEnvironmentMapper } from '../../kernels/deepnote/types';
Expand Down Expand Up @@ -40,6 +41,7 @@ export class DeepnoteActivationService implements IExtensionSyncActivationServic
@inject(IDeepnoteNotebookManager) private readonly notebookManager: IDeepnoteNotebookManager,
@inject(IIntegrationManager) integrationManager: IIntegrationManager,
@inject(ILogger) private readonly logger: ILogger,
@inject(ITelemetryService) private readonly analytics: ITelemetryService,
@inject(SnapshotService) @optional() private readonly snapshotService?: SnapshotService,
@inject(IDeepnoteNotebookEnvironmentMapper)
@optional()
Expand All @@ -57,7 +59,8 @@ export class DeepnoteActivationService implements IExtensionSyncActivationServic
this.explorerView = new DeepnoteExplorerView(
this.extensionContext,
this.logger,
new DeepnoteTreeDataProvider(this.logger)
new DeepnoteTreeDataProvider(this.logger),
this.analytics
);
this.editProtection = new DeepnoteInputBlockEditProtection(this.logger);
this.snapshotsEnabled = this.isSnapshotsEnabled();
Expand Down Expand Up @@ -86,7 +89,8 @@ export class DeepnoteActivationService implements IExtensionSyncActivationServic
this.environmentMapper,
() => this.explorerView.refresh(),
this.logger,
deepnoteFileExists
deepnoteFileExists,
this.analytics
);
this.extensionContext.subscriptions.push(...this.multiNotebookSplitter.activate());
this.extensionContext.subscriptions.push(this.multiNotebookSplitter);
Expand Down
Loading
Loading