Skip to content

Commit 96420af

Browse files
authored
Merge pull request #28 from stackb/telemetry
Add telemetry
2 parents 9a5db3e + dbfb5a0 commit 96420af

15 files changed

Lines changed: 271 additions & 29 deletions

docs/subscribing.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,13 @@ command from the palette or click the *Rocket* icon from the account view:
4343

4444
![get-started](https://user-images.githubusercontent.com/50580/95288941-d88f9500-0826-11eb-8d2e-b981ad2f2cab.gif)
4545

46-
To view your account details or manage your subscription, proceed to <https://build.bzl.io/bzl/user>.
46+
To view your account details or manage your subscription, proceed to
47+
<https://build.bzl.io/bzl/user>.
48+
49+
### Telemetry.
50+
51+
This extension sends telemetry events to collect usage statistics on various
52+
features of the extension to help prioritize new features and/or diagnose
53+
problems. No personal data is collected. To opt out of telemetry, set the
54+
`telemetry.enableTelemetry` to `false` (this is the same flag for vscode
55+
telemetry itself).

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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "bazel-stack-vscode",
33
"displayName": "bazel-stack-vscode",
44
"description": "Bazel Support for Visual Studio Code",
5-
"version": "0.5.0",
5+
"version": "0.5.1",
66
"publisher": "StackBuild",
77
"license": "Apache-2.0",
88
"icon": "stackb-full.png",
@@ -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)