(core) Renaming installationId metadata for checkUpdateAPI telemetry endpoint.

Summary:
CheckUpdateAPI is now storing client's installation id in a new field called 'deploymentId'.
Previously it was using installationId which is reserved (and overriden) by the home server.

Test Plan: Existing and manual

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4268
This commit is contained in:
Jarosław Sadziński 2024-06-12 11:33:13 +02:00
parent f071d91a0a
commit 98176132b0
3 changed files with 15 additions and 4 deletions

View File

@ -1746,7 +1746,7 @@ export const TelemetryContracts: TelemetryContracts = {
minimumTelemetryLevel: Level.limited,
retentionPeriod: 'indefinitely',
metadataContracts: {
installationId: {
deploymentId: {
description: 'The installation id of the client.',
dataType: 'string',
},

View File

@ -334,6 +334,17 @@ export class Telemetry implements ITelemetry {
try {
this._numPendingForwardEventRequests += 1;
const {category: eventCategory} = TelemetryContracts[event];
if (metadata) {
if ('installationId' in metadata ||
'eventSource' in metadata ||
'eventName' in metadata ||
'eventCategory' in metadata)
{
throw new Error('metadata contains reserved keys');
}
}
await this._doForwardEvent(JSON.stringify({
event,
metadata: {

View File

@ -86,7 +86,7 @@ export class UpdateManager {
// This is the most interesting part for us, to track installation ids and match them
// with the version of the client. Won't be send without telemetry opt in.
const installationId = optStringParam(
const deploymentId = optStringParam(
payload("installationId"),
"installationId"
);
@ -104,8 +104,8 @@ export class UpdateManager {
.getTelemetry()
.logEvent(req as RequestWithLogin, "checkedUpdateAPI", {
full: {
installationId,
deploymentType,
deploymentId,
deploymentType
},
});