(core) Add documentCreated telemetry event

Summary:
The event is triggered whenever a document is created, imported, or
duplicated.

Test Plan: Tested manually.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4035
This commit is contained in:
George Gevoian
2023-09-13 00:33:32 -04:00
parent 76e822eb23
commit 40c5f7b738
5 changed files with 141 additions and 9 deletions

View File

@@ -353,6 +353,45 @@ export const TelemetryContracts: TelemetryContracts = {
},
},
},
documentCreated: {
description: 'Triggered when a document is created.',
minimumTelemetryLevel: Level.limited,
retentionPeriod: 'indefinitely',
metadataContracts: {
docIdDigest: {
description: 'A hash of the id of the created document.',
dataType: 'string',
},
sourceDocIdDigest: {
description: 'A hash of the id of the source document, if the document was '
+ 'duplicated from an existing document.',
dataType: 'string',
},
isImport: {
description: 'Whether the document was created by import.',
dataType: 'boolean',
},
isSaved: {
description: 'Whether the document was saved to a workspace.',
dataType: 'boolean',
},
fileType: {
description: 'If the document was created by import, the file extension '
+ 'of the file that was imported.',
dataType: 'string',
},
userId: {
description: 'The id of the user that triggered this event.',
dataType: 'number',
minimumTelemetryLevel: Level.full,
},
altSessionId: {
description: 'A random, session-based identifier for the user that triggered this event.',
dataType: 'string',
minimumTelemetryLevel: Level.full,
},
},
},
documentForked: {
description: 'Triggered when a document is forked.',
minimumTelemetryLevel: Level.limited,
@@ -898,6 +937,7 @@ export const TelemetryEvents = StringUnion(
'beaconArticleViewed',
'beaconEmailSent',
'beaconSearch',
'documentCreated',
'documentForked',
'documentOpened',
'documentUsage',