Skip to content

Commit cf4ed6a

Browse files
committed
Rename telemetry events
Use `.` consistently as the separator in event names. Prefix event names with `xml.`. Group the binary download events into `xml_binary_download`. Add a parameter `status` that indicates if the download succeeded, failed or was aborted. Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent 70cad4d commit cf4ed6a

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

USAGE_DATA.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ vscode-xml has opt-in telemetry collection, provided by [vscode-commons](https:/
1414
* The server version number
1515
* Does NOT include the `JAVA_HOME` environment variable for privacy reasons
1616
* The value of the `xml.server.preferBinary` setting
17-
* A telemetry event is sent every time the binary server download succeeds
18-
* A telemetry event is sent every time the binary server download fails
17+
* A telemetry event is sent every time the binary server download succeeds, fails, or is stopped by the user
18+
* If the download fails, the associated error is attached to the telemetry event
1919
* A telemetry event is sent every time you click the "Download Java" link that appears when you have [LemMinX extensions](./docs/Extensions.md) installed but don't have Java installed.
2020

2121
## What's included in the general telemetry data

src/server/binary/binaryServerStarter.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,20 @@ async function downloadBinary(): Promise<string> {
112112
});
113113
});
114114
downloadPromise.then((_binaryPath) => {
115-
Telemetry.sendTelemetry(Telemetry.BINARY_DOWNLOAD_SUCCEEDED_EVT);
115+
const data: any = {};
116+
data[Telemetry.BINARY_DOWNLOAD_STATUS_PROP] = Telemetry.BINARY_DOWNLOAD_SUCCEEDED;
117+
Telemetry.sendTelemetry(Telemetry.BINARY_DOWNLOAD_EVT, data);
116118
});
117119
downloadPromise.catch(e => {
118120
if (e !== ABORTED_ERROR) {
119-
Telemetry.sendTelemetry(Telemetry.BINARY_DOWNLOAD_FAILED_EVT);
121+
const data: any = {};
122+
data[Telemetry.BINARY_DOWNLOAD_STATUS_PROP] = Telemetry.BINARY_DOWNLOAD_FAILED;
123+
data['error'] = e.toString();
124+
Telemetry.sendTelemetry(Telemetry.BINARY_DOWNLOAD_EVT, data);
125+
} else {
126+
const data: any = {};
127+
data[Telemetry.BINARY_DOWNLOAD_STATUS_PROP] = Telemetry.BINARY_DOWNLOAD_ABORTED;
128+
Telemetry.sendTelemetry(Telemetry.BINARY_DOWNLOAD_EVT, data);
120129
}
121130
});
122131
return downloadPromise;

src/telemetry.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
import { getTelemetryService, TelemetryEvent, TelemetryService } from "@redhat-developer/vscode-redhat-telemetry/lib";
1+
import { getTelemetryService, TelemetryService } from "@redhat-developer/vscode-redhat-telemetry/lib";
22

33
/**
44
* Wrap vscode-redhat-telemetry to suit vscode-xml
55
*/
66
export namespace Telemetry {
77

8-
export const OPEN_JAVA_DOWNLOAD_LINK_EVT: string = "open_java_download_link";
9-
export const SETTINGS_EVT: string = "settings";
10-
export const BINARY_DOWNLOAD_SUCCEEDED_EVT: string = "binary_download_succeeded";
11-
export const BINARY_DOWNLOAD_FAILED_EVT: string = "binary_download_failed";
8+
export const OPEN_JAVA_DOWNLOAD_LINK_EVT = "xml.open.java.download.link";
9+
export const SETTINGS_EVT = "xml.settings";
10+
export const BINARY_DOWNLOAD_EVT = "xml.binary.download";
11+
12+
export const BINARY_DOWNLOAD_STATUS_PROP = "status";
13+
14+
export const BINARY_DOWNLOAD_SUCCEEDED = "succeeded";
15+
export const BINARY_DOWNLOAD_FAILED = "failed";
16+
export const BINARY_DOWNLOAD_ABORTED = "aborted";
1217

1318
let _telemetryManager: TelemetryService = null;
1419

@@ -43,4 +48,4 @@ export namespace Telemetry {
4348
});
4449
}
4550

46-
}
51+
}

0 commit comments

Comments
 (0)