Skip to content

Commit d2dea7f

Browse files
committed
Add telemetry
1 parent 0512f21 commit d2dea7f

13 files changed

Lines changed: 260 additions & 9 deletions

package-lock.json

Lines changed: 107 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,7 @@
10301030
"tmp": "0.2.1",
10311031
"uuid": "8.3.0",
10321032
"vscode-common": "1.49.0",
1033+
"vscode-extension-telemetry": "^0.1.6",
10331034
"vscode-languageclient": "6.1.3"
10341035
},
10351036
"devDependencies": {

src/bzl/commandrunner.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as grpc from '@grpc/grpc-js';
22
import * as protobuf from 'protobufjs';
33
import * as vscode from 'vscode';
4+
import { Telemetry } from '../constants';
5+
import { Container } from '../container';
46
import { CancelResponse } from '../proto/build/stack/bezel/v1beta1/CancelResponse';
57
import { EnvironmentVariable } from '../proto/build/stack/bezel/v1beta1/EnvironmentVariable';
68
import { ExecRequest } from '../proto/build/stack/bezel/v1beta1/ExecRequest';
@@ -80,6 +82,9 @@ export class BzlServerCommandRunner implements vscode.Disposable, CommandTaskRun
8082
if (!client) {
8183
return Promise.reject('bzl client not available');
8284
}
85+
86+
Container.telemetry.sendTelemetryEvent(Telemetry.BzlRunTask);
87+
8388
return vscode.window.withProgress<void>(
8489
{
8590
location: vscode.ProgressLocation.Notification,

src/bzl/view/events.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as path from 'path';
44
import { URL } from 'url';
55
import * as vscode from 'vscode';
66
import { markers, markerService, problemMatcher } from 'vscode-common';
7-
import { BuiltInCommands } from '../../constants';
7+
import { BuiltInCommands, Telemetry } from '../../constants';
88
import { Container, MediaIconName } from '../../container';
99
import { downloadAsset } from '../../download';
1010
import { FileKind } from '../../proto/build/stack/bezel/v1beta1/FileKind';
@@ -202,6 +202,8 @@ export class BuildEventProtocolView extends BzlClientTreeDataProvider<BazelBuild
202202
}
203203

204204
async handleStartedEvent(e: BazelBuildEvent, started: BuildStarted) {
205+
Container.telemetry.sendTelemetryEvent(Telemetry.BzlEventBuildStarted);
206+
205207
this.clear();
206208
this.state.started = started;
207209
this.problemCollector.started = started;

src/bzl/view/packages.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as fs from 'graceful-fs';
33
import * as path from 'path';
44
import * as vscode from 'vscode';
55
import { utils } from 'vscode-common';
6-
import { BuiltInCommands } from '../../constants';
6+
import { BuiltInCommands, Telemetry } from '../../constants';
77
import { Container, MediaIconName } from '../../container';
88
import { ExternalWorkspace } from '../../proto/build/stack/bezel/v1beta1/ExternalWorkspace';
99
import { LabelKind } from '../../proto/build/stack/bezel/v1beta1/LabelKind';
@@ -19,7 +19,7 @@ import {
1919
ContextValue,
2020
FileName,
2121
ruleClassIconUri,
22-
ViewName,
22+
ViewName
2323
} from '../constants';
2424
import { BzlClientTreeDataProvider } from './bzlclienttreedataprovider';
2525

@@ -353,6 +353,9 @@ export class BzlPackageListView extends BzlClientTreeDataProvider<Node> {
353353
if (!this.currentWorkspace) {
354354
return undefined;
355355
}
356+
357+
Container.telemetry.sendTelemetryEvent(Telemetry.BzlPackageList);
358+
356359
const pkgs = await this.client?.listPackages(
357360
this.currentWorkspace,
358361
this.currentExternalWorkspace

src/bzl/view/repositories.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as findUp from 'find-up';
22
import * as path from 'path';
33
import * as vscode from 'vscode';
4-
import { BuiltInCommands } from '../../constants';
4+
import { BuiltInCommands, Telemetry } from '../../constants';
55
import { Container, MediaIconName } from '../../container';
66
import { Workspace } from '../../proto/build/stack/bezel/v1beta1/Workspace';
77
import { BzlClient } from '../bzlclient';
@@ -78,6 +78,8 @@ export class BzlRepositoryListView extends BzlClientTreeDataProvider<RepositoryI
7878
}
7979
}
8080

81+
Container.telemetry.sendTelemetryEvent(Telemetry.BzlRepositoryList);
82+
8183
const workspaces = await client?.listWorkspaces(this.wasManuallyRefreshed);
8284
return this.createWorkspaceMetadataItems(workspaces, currentCwd!);
8385
}

0 commit comments

Comments
 (0)