Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e89b6b6
feat(telemetry): add PostHog analytics for tracking notebook usage ev…
tkislan Mar 29, 2026
2cc5a5b
fix(deps): regenerate lockfile with Node 22 npm to fix drift check
tkislan Mar 29, 2026
01b41d0
refactor(telemetry): rename PostHogAnalyticsService to TelemetryService
tkislan Mar 30, 2026
c1181bd
refactor(telemetry): use typed event names and single-argument trackE…
tkislan Mar 30, 2026
2cd604d
refactor(telemetry): make ITelemetryService non-optional with web no-op
tkislan Mar 30, 2026
8ca48b3
refactor(telemetry): replace ITelemetryService with NoOpTelemetryServ…
tkislan Mar 30, 2026
282cad6
Update tests
tkislan Mar 30, 2026
bd79356
refactor(tests): update telemetry service usage in Deepnote tests
tkislan Apr 1, 2026
21aab9a
refactor(telemetry): enhance TelemetryService with activation and cli…
tkislan Apr 2, 2026
8d4d7c4
Merge origin/main into feat/posthog-telemetry
tkislan Jul 17, 2026
f4cc7ac
feat(telemetry): cover new user actions and fix completion accuracy
tkislan Jul 17, 2026
8c04f54
test(e2e): harden project-rename setup against a stale-element race
tkislan Jul 17, 2026
fbd4a65
fix(telemetry): bake PostHog API key into CD builds
tkislan Jul 17, 2026
3f4eef5
fix(telemetry): report rename_project completion accurately
tkislan Jul 17, 2026
d9f88d6
fix(telemetry): skip PostHog init when the API key is unconfigured
tkislan Jul 18, 2026
1799d1c
fix(telemetry): address PR review findings across telemetry events
tkislan Jul 19, 2026
5c9cc69
fix(deepnote): localize error message for notebook import failures
tkislan Jul 19, 2026
11cf5c6
feat(telemetry): typed events, common properties, and stable anonymou…
tkislan Jul 19, 2026
0817943
refactor(telemetry): simplify event tracking structure
tkislan Jul 20, 2026
ff044bc
Remove unnecessary conditional chaining
tkislan Jul 31, 2026
8db8fa1
Remove unnecessary code comment
tkislan Jul 31, 2026
2dd979d
refactor(telemetry): update event properties for environment creation…
tkislan Jul 31, 2026
2569dd4
feat(telemetry): cover user actions shipped while the PR sat idle
tkislan Jul 31, 2026
7804d7e
test(telemetry): replace hand-rolled ITelemetryService stubs with ts-…
tkislan Jul 31, 2026
22b9169
test(e2e): take main's version of the project-rename stale-element fix
tkislan Jul 31, 2026
4e2f611
fix(telemetry): address review findings on PostHog instrumentation
tkislan Aug 3, 2026
303402a
test(telemetry): assert every tracked event, and drop no-op churn
tkislan Aug 3, 2026
705016d
test(telemetry): cut redundant assertions, merge the rest
tkislan Aug 3, 2026
c62de6f
Reword comment
tkislan Aug 3, 2026
33b3f08
docs(telemetry): cut comment narration, keep the reasons
tkislan Aug 4, 2026
dc85e50
Merge branch 'main' into feat/posthog-telemetry
tkislan Aug 4, 2026
a4b6286
Merge branch 'main' into feat/posthog-telemetry
tkislan Aug 4, 2026
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
98 changes: 89 additions & 9 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 @@ -1650,6 +1650,12 @@
"description": "Disable SSL certificate verification (for development only)",
"scope": "application"
},
"deepnote.telemetry.enabled": {
"type": "boolean",
"default": true,
"description": "Enable anonymous usage telemetry to help improve Deepnote for VS Code.",
"scope": "application"
},
Comment thread
tkislan marked this conversation as resolved.
"deepnote.snapshots.enabled": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -2725,6 +2731,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
8 changes: 8 additions & 0 deletions src/extension.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import './platform/logging';
import { commands, env, ExtensionMode, UIKind, workspace, type OutputChannel } from 'vscode';
import { buildApi, IExtensionApi } from './standalone/api';
import { logger, setHomeDirectory } from './platform/logging';
import { IPostHogAnalyticsService } from './platform/analytics/types';
import { IAsyncDisposableRegistry, IExtensionContext, IsDevMode } from './platform/common/types';
import { IServiceContainer, IServiceManager } from './platform/ioc/types';
import { sendStartupTelemetry } from './platform/telemetry/startupTelemetry';
Expand Down Expand Up @@ -133,7 +134,14 @@ export function deactivate(): Thenable<void> {
Exiting.isExiting = true;
// Make sure to shutdown anybody who needs it.
if (activatedServiceContainer) {
const analytics = activatedServiceContainer.tryGet<IPostHogAnalyticsService>(IPostHogAnalyticsService);

if (analytics) {
void analytics.shutdown();
}
Comment thread
tkislan marked this conversation as resolved.
Outdated

const registry = activatedServiceContainer.get<IAsyncDisposableRegistry>(IAsyncDisposableRegistry);

if (registry) {
return registry.dispose();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inject, injectable, named } from 'inversify';
import { inject, injectable, named, optional } from 'inversify';
import {
commands,
Disposable,
Expand All @@ -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 { IPostHogAnalyticsService } 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 @@ -52,7 +53,8 @@ export class DeepnoteEnvironmentsView implements Disposable {
@inject(IDeepnoteNotebookEnvironmentMapper)
private readonly notebookEnvironmentMapper: IDeepnoteNotebookEnvironmentMapper,
@inject(IKernelProvider) private readonly kernelProvider: IKernelProvider,
@inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly outputChannel: IOutputChannel
@inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private readonly outputChannel: IOutputChannel,
@inject(IPostHogAnalyticsService) @optional() private readonly analytics: IPostHogAnalyticsService | undefined
) {
// Create tree data provider

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

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

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

this.analytics?.trackEvent('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 @@ -483,6 +491,7 @@ export class DeepnoteEnvironmentsView implements Disposable {
}
);

this.analytics?.trackEvent('select_environment');
void window.showInformationMessage(l10n.t('Environment switched successfully'));
} catch (error) {
if (error instanceof DeepnoteToolkitMissingError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ suite('DeepnoteEnvironmentsView', () => {
instance(mockKernelAutoSelector),
instance(mockNotebookEnvironmentMapper),
instance(mockKernelProvider),
instance(mockOutputChannel)
instance(mockOutputChannel),
undefined
);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});

Expand Down
11 changes: 9 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 { IPostHogAnalyticsService } from '../../platform/analytics/types';
import { IExtensionContext } from '../../platform/common/types';
import { ILogger } from '../../platform/logging/types';
import { IDeepnoteNotebookManager } from '../types';
Expand Down Expand Up @@ -34,7 +35,8 @@ export class DeepnoteActivationService implements IExtensionSyncActivationServic
@inject(IDeepnoteNotebookManager) private readonly notebookManager: IDeepnoteNotebookManager,
@inject(IIntegrationManager) integrationManager: IIntegrationManager,
@inject(ILogger) private readonly logger: ILogger,
@inject(SnapshotService) @optional() private readonly snapshotService?: SnapshotService
@inject(SnapshotService) @optional() private readonly snapshotService?: SnapshotService,
@inject(IPostHogAnalyticsService) @optional() private readonly analytics?: IPostHogAnalyticsService
) {
this.integrationManager = integrationManager;
}
Expand All @@ -45,7 +47,12 @@ export class DeepnoteActivationService implements IExtensionSyncActivationServic
*/
public activate() {
this.serializer = new DeepnoteNotebookSerializer(this.notebookManager, this.snapshotService);
this.explorerView = new DeepnoteExplorerView(this.extensionContext, this.notebookManager, this.logger);
this.explorerView = new DeepnoteExplorerView(
this.extensionContext,
this.notebookManager,
this.logger,
this.analytics
);
this.editProtection = new DeepnoteInputBlockEditProtection(this.logger);
this.snapshotsEnabled = this.isSnapshotsEnabled();

Expand Down
63 changes: 63 additions & 0 deletions src/notebooks/deepnote/deepnoteCellExecutionAnalytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { inject, injectable, optional } from 'inversify';
import { Disposable } from 'vscode';

import { IExtensionSyncActivationService } from '../../platform/activation/types';
import { IPostHogAnalyticsService } from '../../platform/analytics/types';
import { IDisposableRegistry } from '../../platform/common/types';
import { NotebookCellExecutionState, notebookCellExecutions } from '../../platform/notebooks/cellExecutionStateService';
import { IDeepnoteNotebookManager } from '../types';

/**
* Tracks cell execution events for PostHog analytics.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
*/
@injectable()
export class DeepnoteCellExecutionAnalytics implements IExtensionSyncActivationService {
constructor(
@inject(IPostHogAnalyticsService) @optional() private readonly analytics: IPostHogAnalyticsService | undefined,
@inject(IDeepnoteNotebookManager) private readonly notebookManager: IDeepnoteNotebookManager,
@inject(IDisposableRegistry) private readonly disposables: Disposable[]
) {}
Comment thread
tkislan marked this conversation as resolved.

public activate(): void {
if (!this.analytics) {
return;
}

this.disposables.push(
notebookCellExecutions.onDidChangeNotebookCellExecutionState((e) => {
if (e.state !== NotebookCellExecutionState.Executing) {
return;
}

if (e.cell.notebook.notebookType !== 'deepnote') {
return;
}

const languageId = e.cell.document.languageId;
const cellType = languageId === 'sql' ? 'sql' : languageId === 'markdown' ? 'markdown' : 'code';

const properties: Record<string, string> = { cellType };

if (cellType === 'sql') {
const integrationId =
e.cell.metadata?.__deepnotePocket?.sql_integration_id ?? e.cell.metadata?.sql_integration_id;

if (integrationId) {
const projectId = e.cell.notebook.metadata?.deepnoteProjectId;

if (projectId) {
const project = this.notebookManager.getOriginalProject(projectId);
const integration = project?.project.integrations?.find((i) => i.id === integrationId);

if (integration?.type) {
properties.integrationType = integration.type;
}
}
}
}

this.analytics?.trackEvent('execute_cell', properties);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
})
);
}
}
Loading
Loading