(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
pull/1039/head
Jarosław Sadziński 3 months ago
parent f071d91a0a
commit 98176132b0

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

@ -334,6 +334,17 @@ export class Telemetry implements ITelemetry {
try { try {
this._numPendingForwardEventRequests += 1; this._numPendingForwardEventRequests += 1;
const {category: eventCategory} = TelemetryContracts[event]; 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({ await this._doForwardEvent(JSON.stringify({
event, event,
metadata: { metadata: {

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

Loading…
Cancel
Save