2023-06-06 17:08:50 +00:00
|
|
|
import {StringUnion} from 'app/common/StringUnion';
|
2023-04-06 15:10:29 +00:00
|
|
|
|
2023-06-06 17:08:50 +00:00
|
|
|
/**
|
|
|
|
* Telemetry levels, in increasing order of data collected.
|
|
|
|
*/
|
|
|
|
export enum Level {
|
|
|
|
off = 0,
|
|
|
|
limited = 1,
|
|
|
|
full = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A set of contracts that all telemetry events must follow prior to being
|
|
|
|
* logged.
|
|
|
|
*
|
|
|
|
* Currently, this includes meeting minimum telemetry levels for events
|
|
|
|
* and their metadata, and passing in the correct data type for the value of
|
|
|
|
* each metadata property.
|
|
|
|
*
|
|
|
|
* The `minimumTelemetryLevel` defined at the event level will also be applied
|
|
|
|
* to all metadata properties of an event, and can be overridden at the metadata
|
|
|
|
* level.
|
|
|
|
*/
|
|
|
|
export const TelemetryContracts: TelemetryContracts = {
|
|
|
|
apiUsage: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when an HTTP request with an API key is made.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
method: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The HTTP request method (e.g. GET, POST, PUT).',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
userAgent: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The User-Agent HTTP request header.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-07-20 14:25:26 +00:00
|
|
|
assistantOpen: {
|
|
|
|
description: 'Triggered when the AI Assistant is first opened.',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
retentionPeriod: 'short',
|
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
|
|
|
description: 'A hash of the doc id.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
conversationId: {
|
|
|
|
description: 'A random identifier for the current conversation with the assistant.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
context: {
|
|
|
|
description: 'The type of assistant (e.g. "formula"), table id, and column id.',
|
|
|
|
dataType: 'object',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that triggered this event.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
assistantSend: {
|
|
|
|
description: 'Triggered when a message is sent to the AI Assistant.',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
retentionPeriod: 'short',
|
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
|
|
|
description: 'A hash of the doc id.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
siteId: {
|
|
|
|
description: 'The id of the site.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
siteType: {
|
|
|
|
description: 'The type of the site.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
access: {
|
|
|
|
description: 'The document access level of the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that triggered this event.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
conversationId: {
|
|
|
|
description: 'A random identifier for the current conversation with the assistant.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
context: {
|
|
|
|
description: 'The type of assistant (e.g. "formula"), table id, and column id.',
|
|
|
|
dataType: 'object',
|
|
|
|
},
|
|
|
|
prompt: {
|
|
|
|
description: 'The role ("user" or "system"), content, and index of the message sent to the AI Assistant.',
|
|
|
|
dataType: 'object',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
assistantReceive: {
|
|
|
|
description: 'Triggered when a message is received from the AI Assistant is received.',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
retentionPeriod: 'short',
|
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
|
|
|
description: 'A hash of the doc id.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
siteId: {
|
|
|
|
description: 'The id of the site.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
siteType: {
|
|
|
|
description: 'The type of the site.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
access: {
|
|
|
|
description: 'The document access level of the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that triggered this event.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
conversationId: {
|
|
|
|
description: 'A random identifier for the current conversation with the assistant.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
context: {
|
|
|
|
description: 'The type of assistant (e.g. "formula"), table id, and column id.',
|
|
|
|
dataType: 'object',
|
|
|
|
},
|
|
|
|
message: {
|
|
|
|
description: 'The content and index of the message received from the AI Assistant.',
|
|
|
|
dataType: 'object',
|
|
|
|
},
|
|
|
|
suggestedFormula: {
|
|
|
|
description: 'The formula suggested by the AI Assistant, if present.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
assistantSave: {
|
|
|
|
description: 'Triggered when changes in the expanded formula editor are saved after the AI Assistant ' +
|
|
|
|
'was opened.',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
retentionPeriod: 'short',
|
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
|
|
|
description: 'A hash of the doc id.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
conversationId: {
|
|
|
|
description: 'A random identifier for the current conversation with the assistant.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
context: {
|
|
|
|
description: 'The type of assistant (e.g. "formula"), table id, and column id.',
|
|
|
|
dataType: 'object',
|
|
|
|
},
|
|
|
|
newFormula: {
|
|
|
|
description: 'The formula that was saved.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
oldFormula: {
|
|
|
|
description: 'The formula that was overwritten.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that triggered this event.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
assistantCancel: {
|
|
|
|
description: 'Triggered when changes in the expanded formula editor are discarded after the AI Assistant ' +
|
|
|
|
'was opened.',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
retentionPeriod: 'short',
|
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
|
|
|
description: 'A hash of the doc id.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
conversationId: {
|
|
|
|
description: 'A random identifier for the current conversation with the assistant.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
context: {
|
|
|
|
description: 'The type of assistant (e.g. "formula"), table id, and column id.',
|
|
|
|
dataType: 'object',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that triggered this event.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
assistantClearConversation: {
|
|
|
|
description: 'Triggered when a conversation in the AI Assistant is cleared.',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
retentionPeriod: 'short',
|
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
|
|
|
description: 'A hash of the doc id.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
conversationId: {
|
|
|
|
description: 'A random identifier for the current conversation with the assistant.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
context: {
|
|
|
|
description: 'The type of assistant (e.g. "formula"), table id, and column id.',
|
|
|
|
dataType: 'object',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that triggered this event.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
assistantClose: {
|
|
|
|
description: 'Triggered when a formula is saved or discarded after the AI Assistant was opened.',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
retentionPeriod: 'indefinitely',
|
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
|
|
|
description: 'A hash of the doc id.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
conversationId: {
|
|
|
|
description: 'A random identifier for the current conversation with the assistant.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
suggestionApplied: {
|
|
|
|
description: 'True if a suggested formula from one of the received messages was applied.',
|
|
|
|
dataType: 'boolean',
|
|
|
|
},
|
|
|
|
conversationLength: {
|
|
|
|
description: 'The number of messages sent and received since opening the AI Assistant.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
conversationHistoryLength: {
|
|
|
|
description: "The number of messages in the conversation's history. May be less than conversationLength "
|
|
|
|
+ "if the conversation history was cleared in the same session.",
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that triggered this event.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-06-06 17:08:50 +00:00
|
|
|
beaconOpen: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when HelpScout Beacon is opened.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
beaconArticleViewed: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when an article is opened in HelpScout Beacon.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
articleId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the article.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
beaconEmailSent: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when an email is sent in HelpScout Beacon.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
beaconSearch: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when a search is made in HelpScout Beacon.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
searchQuery: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The search query.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
documentForked: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when a document is forked.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.limited,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the doc id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
siteId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the site containing the forked document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
siteType: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The type of the site.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
2023-06-09 16:32:40 +00:00
|
|
|
access: {
|
|
|
|
description: 'The document access level of the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
2023-06-06 17:08:50 +00:00
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
forkIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the fork id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
forkDocIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the full id of the fork, including the trunk id and fork id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
trunkIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the trunk id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
isTemplate: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Whether the trunk is a template.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'boolean',
|
|
|
|
},
|
|
|
|
lastActivity: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Timestamp of the last update to the trunk document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'date',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
documentOpened: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when a public document or template is opened.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.limited,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the doc id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
siteId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
siteType: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site type.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
access: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The document access level of the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
2023-06-06 17:08:50 +00:00
|
|
|
},
|
|
|
|
isPublic: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Whether the document is public.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'boolean',
|
|
|
|
},
|
|
|
|
isSnapshot: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Whether a snapshot was opened.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'boolean',
|
|
|
|
},
|
|
|
|
isTemplate: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Whether the document is a template.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'boolean',
|
|
|
|
},
|
|
|
|
lastUpdated: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Timestamp of when the document was last updated.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'date',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
documentUsage: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered on doc open and close, as well as hourly while a document is open.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.limited,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
docIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the doc id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
siteId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
siteType: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site type.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
2023-06-09 16:32:40 +00:00
|
|
|
access: {
|
|
|
|
description: 'The document access level of the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
2023-06-06 17:08:50 +00:00
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
triggeredBy: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'What caused this event to trigger. May be either "docOpen", "interval", or "docClose".',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
isPublic: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Whether the document is public.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'boolean',
|
|
|
|
},
|
|
|
|
rowCount: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of rows in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
dataSizeBytes: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The total size of all data in the document, excluding attachments.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
attachmentsSize: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The total size of all attachments in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numAccessRules: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of access rules in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numUserAttributes: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of user attributes in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numAttachments: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of attachments in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
attachmentTypes: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: "A list of unique file extensions compiled from all of the document's attachments.",
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string[]',
|
|
|
|
},
|
|
|
|
numCharts: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of charts in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
chartTypes: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A list of chart types of every chart in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string[]',
|
|
|
|
},
|
|
|
|
numLinkedCharts: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of linked charts in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numLinkedWidgets: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of linked widgets in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numColumns: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of columns in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numColumnsWithConditionalFormatting: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of columns with conditional formatting in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numFormulaColumns: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of formula columns in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numTriggerFormulaColumns: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of trigger formula columns in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numSummaryFormulaColumns: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of summary formula columns in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numFieldsWithConditionalFormatting: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of fields with conditional formatting in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numTables: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of tables in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numOnDemandTables: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of on-demand tables in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numTablesWithConditionalFormatting: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of tables with conditional formatting in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numSummaryTables: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of summary tables in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numCustomWidgets: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of custom widgets in the document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
customWidgetIds: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A list of plugin ids for every custom widget in the document. '
|
|
|
|
+ 'The ids of widgets not created by Grist Labs are replaced with "externalId".',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string[]',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
processMonitor: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered every 5 seconds.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
heapUsedMB: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Size of JS heap in use, in MiB.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
heapTotalMB: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Total heap size, in MiB, allocated for JS by V8. ',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
cpuAverage: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Fraction (typically between 0 and 1) of CPU usage. Includes all threads, so may exceed 1.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
intervalMs: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Interval (in milliseconds) over which `cpuAverage` is reported.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
sendingWebhooks: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when sending webhooks.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.limited,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
numEvents: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of events in the batch of webhooks being sent.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
docIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the doc id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
siteId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
siteType: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site type.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
2023-06-09 16:32:40 +00:00
|
|
|
access: {
|
|
|
|
description: 'The document access level of the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
2023-06-06 17:08:50 +00:00
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-06-15 00:03:17 +00:00
|
|
|
signupFirstVisit: {
|
|
|
|
description: 'Triggered when a new user first opens the Grist app',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-15 00:03:17 +00:00
|
|
|
metadataContracts: {
|
|
|
|
siteId: {
|
|
|
|
description: 'The site id of first visit after signup.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
siteType: {
|
|
|
|
description: 'The site type of first visit after signup.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that signed up.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-06-06 17:08:50 +00:00
|
|
|
signupVerified: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered after a user successfully verifies their account during sign-up. '
|
|
|
|
+ 'Not triggered in grist-core.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
isAnonymousTemplateSignup: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Whether the user viewed any templates before signing up.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'boolean',
|
|
|
|
},
|
|
|
|
templateId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The doc id of the template the user last viewed before signing up, if any.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
siteMembership: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered daily.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.limited,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
siteId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
siteType: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site type.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
numOwners: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of users with an owner role in this site.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numEditors: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of users with an editor role in this site.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numViewers: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of users with a viewer role in this site.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
siteUsage: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered daily.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.limited,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
siteId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
siteType: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site type.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
inGoodStanding: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: "Whether the site's subscription is in good standing.",
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'boolean',
|
|
|
|
},
|
|
|
|
stripePlanId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The Stripe Plan id associated with this site.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
numDocs: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of docs in this site.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numWorkspaces: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of workspaces in this site.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numMembers: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of site members.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
lastActivity: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A timestamp of the most recent update made to a site document.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'date',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tutorialProgressChanged: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered on changes to tutorial progress.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
tutorialForkIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the tutorial fork id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
tutorialTrunkIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the tutorial trunk id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
lastSlideIndex: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The 0-based index of the last tutorial slide the user had open.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
numSlides: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The total number of slides in the tutorial.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
percentComplete: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Percentage of tutorial completion.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
2023-07-20 14:25:26 +00:00
|
|
|
userId: {
|
|
|
|
description: 'The id of the user that triggered this event.',
|
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
2023-06-06 17:08:50 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
tutorialRestarted: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when a tutorial is restarted.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.full,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
tutorialForkIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the tutorial fork id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
tutorialTrunkIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the tutorial trunk id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
docIdDigest: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A hash of the doc id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
siteId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site id.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
siteType: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The site type.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
access: {
|
|
|
|
description: 'The document access level of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
},
|
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watchedVideoTour: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'Triggered when the video tour is closed.',
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level.limited,
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: 'indefinitely',
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts: {
|
|
|
|
watchTimeSeconds: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The number of seconds elapsed in the video player.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
},
|
|
|
|
userId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'The id of the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'number',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
altSessionId: {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: 'A random, session-based identifier for the user that triggered this event.',
|
2023-06-06 17:08:50 +00:00
|
|
|
dataType: 'string',
|
|
|
|
minimumTelemetryLevel: Level.full,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
type TelemetryContracts = Record<TelemetryEvent, TelemetryEventContract>;
|
|
|
|
|
|
|
|
export const TelemetryEvents = StringUnion(
|
2023-04-06 15:10:29 +00:00
|
|
|
'apiUsage',
|
2023-07-20 14:25:26 +00:00
|
|
|
'assistantOpen',
|
|
|
|
'assistantSend',
|
|
|
|
'assistantReceive',
|
|
|
|
'assistantSave',
|
|
|
|
'assistantCancel',
|
|
|
|
'assistantClearConversation',
|
|
|
|
'assistantClose',
|
2023-04-06 15:10:29 +00:00
|
|
|
'beaconOpen',
|
|
|
|
'beaconArticleViewed',
|
|
|
|
'beaconEmailSent',
|
|
|
|
'beaconSearch',
|
|
|
|
'documentForked',
|
|
|
|
'documentOpened',
|
|
|
|
'documentUsage',
|
(core) For exporting XLSX, do it memory-efficiently in a worker thread.
Summary:
- Excel exports were awfully memory-inefficient, causing occasional docWorker
crashes. The fix is to use the "streaming writer" option of ExcelJS
https://github.com/exceljs/exceljs#streaming-xlsx-writercontents. (Empirically
on one example, max memory went down from 3G to 100M)
- It's also CPU intensive and synchronous, and can block node for tens of
seconds. The fix is to use a worker-thread. This diff uses "piscina" library
for a pool of threads.
- Additionally, adds ProcessMonitor that logs memory and cpu usage,
particularly when those change significantly.
- Also introduces request cancellation, so that a long download cancelled by
the user will cancel the work being done in the worker thread.
Test Plan:
Updated previous export tests; memory and CPU performance tested
manually by watching output of ProcessMonitor.
Difference visible in these log excerpts:
Before (total time to serve request 22 sec):
```
Telemetry processMonitor heapUsedMB=2187, heapTotalMB=2234, cpuAverage=1.13, intervalMs=17911
Telemetry processMonitor heapUsedMB=2188, heapTotalMB=2234, cpuAverage=0.66, intervalMs=5005
Telemetry processMonitor heapUsedMB=2188, heapTotalMB=2234, cpuAverage=0, intervalMs=5005
Telemetry processMonitor heapUsedMB=71, heapTotalMB=75, cpuAverage=0.13, intervalMs=5002
```
After (total time to server request 18 sec):
```
Telemetry processMonitor heapUsedMB=109, heapTotalMB=144, cpuAverage=0.5, intervalMs=5001
Telemetry processMonitor heapUsedMB=109, heapTotalMB=144, cpuAverage=1.39, intervalMs=5002
Telemetry processMonitor heapUsedMB=94, heapTotalMB=131, cpuAverage=1.13, intervalMs=5000
Telemetry processMonitor heapUsedMB=94, heapTotalMB=131, cpuAverage=1.35, intervalMs=5001
```
Note in "Before" that heapTotalMB goes up to 2GB in the first case, and "intervalMs" of 17 seconds indicates that node was unresponsive for that long. In the second case, heapTotalMB stays low, and the main thread remains responsive the whole time.
Reviewers: jarek
Reviewed By: jarek
Differential Revision: https://phab.getgrist.com/D3906
2023-06-01 13:09:50 +00:00
|
|
|
'processMonitor',
|
2023-04-06 15:10:29 +00:00
|
|
|
'sendingWebhooks',
|
2023-06-15 00:03:17 +00:00
|
|
|
'signupFirstVisit',
|
2023-04-06 15:10:29 +00:00
|
|
|
'signupVerified',
|
|
|
|
'siteMembership',
|
|
|
|
'siteUsage',
|
|
|
|
'tutorialProgressChanged',
|
|
|
|
'tutorialRestarted',
|
|
|
|
'watchedVideoTour',
|
2023-06-06 17:08:50 +00:00
|
|
|
);
|
|
|
|
export type TelemetryEvent = typeof TelemetryEvents.type;
|
|
|
|
|
|
|
|
interface TelemetryEventContract {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: string;
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel: Level;
|
2023-07-20 14:25:26 +00:00
|
|
|
retentionPeriod: TelemetryRetentionPeriod;
|
2023-06-06 17:08:50 +00:00
|
|
|
metadataContracts?: Record<string, MetadataContract>;
|
|
|
|
}
|
|
|
|
|
2023-07-20 14:25:26 +00:00
|
|
|
export type TelemetryRetentionPeriod = 'short' | 'indefinitely';
|
|
|
|
|
2023-06-06 17:08:50 +00:00
|
|
|
interface MetadataContract {
|
2023-06-09 16:32:40 +00:00
|
|
|
description: string;
|
2023-07-20 14:25:26 +00:00
|
|
|
dataType: 'boolean' | 'number' | 'string' | 'string[]' | 'date' | 'object';
|
2023-06-06 17:08:50 +00:00
|
|
|
minimumTelemetryLevel?: Level;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type TelemetryMetadataByLevel = Partial<Record<EnabledTelemetryLevel, TelemetryMetadata>>;
|
|
|
|
|
|
|
|
export type EnabledTelemetryLevel = Exclude<TelemetryLevel, 'off'>;
|
|
|
|
|
|
|
|
export const TelemetryLevels = StringUnion('off', 'limited', 'full');
|
|
|
|
export type TelemetryLevel = typeof TelemetryLevels.type;
|
|
|
|
|
|
|
|
export type TelemetryMetadata = Record<string, any>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of a cookie that's set whenever a template is opened.
|
|
|
|
*
|
|
|
|
* The cookie remembers the last template that was opened, which is then read during
|
|
|
|
* sign-up to track which templates were viewed before sign-up.
|
|
|
|
*/
|
|
|
|
export const TELEMETRY_TEMPLATE_SIGNUP_COOKIE_NAME = 'gr_template_signup_trk';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a function that accepts a telemetry event and metadata, and performs various
|
|
|
|
* checks on it based on a set of contracts and the `telemetryLevel`.
|
|
|
|
*
|
|
|
|
* The function throws if any checks fail.
|
|
|
|
*/
|
|
|
|
export function buildTelemetryEventChecker(telemetryLevel: TelemetryLevel) {
|
|
|
|
const currentTelemetryLevel = Level[telemetryLevel];
|
|
|
|
|
|
|
|
return (event: TelemetryEvent, metadata?: TelemetryMetadata) => {
|
|
|
|
const eventContract = TelemetryContracts[event];
|
|
|
|
if (!eventContract) {
|
|
|
|
throw new Error(`Unknown telemetry event: ${event}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
const eventMinimumTelemetryLevel = eventContract.minimumTelemetryLevel;
|
|
|
|
if (currentTelemetryLevel < eventMinimumTelemetryLevel) {
|
|
|
|
throw new Error(
|
|
|
|
`Telemetry event ${event} requires a minimum telemetry level of ${eventMinimumTelemetryLevel} ` +
|
|
|
|
`but the current level is ${currentTelemetryLevel}`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(metadata ?? {})) {
|
|
|
|
const metadataContract = eventContract.metadataContracts?.[key];
|
|
|
|
if (!metadataContract) {
|
|
|
|
throw new Error(`Unknown metadata for telemetry event ${event}: ${key}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
const metadataMinimumTelemetryLevel = metadataContract.minimumTelemetryLevel;
|
|
|
|
if (metadataMinimumTelemetryLevel && currentTelemetryLevel < metadataMinimumTelemetryLevel) {
|
|
|
|
throw new Error(
|
|
|
|
`Telemetry metadata ${key} of event ${event} requires a minimum telemetry level of ` +
|
|
|
|
`${metadataMinimumTelemetryLevel} but the current level is ${currentTelemetryLevel}`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const {dataType} = metadataContract;
|
|
|
|
if (dataType.endsWith('[]')) {
|
|
|
|
if (!Array.isArray(value)) {
|
|
|
|
throw new Error(
|
|
|
|
`Telemetry metadata ${key} of event ${event} expected a value of type array ` +
|
|
|
|
`but received a value of type ${typeof value}`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const elementDataType = dataType.slice(0, -2);
|
|
|
|
if (value.some(element => typeof element !== elementDataType)) {
|
|
|
|
throw new Error(
|
|
|
|
`Telemetry metadata ${key} of event ${event} expected a value of type ${elementDataType}[] ` +
|
|
|
|
`but received a value of type ${typeof value}[]`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else if (dataType === 'date') {
|
|
|
|
if (!(value instanceof Date) && typeof value !== 'string') {
|
|
|
|
throw new Error(
|
|
|
|
`Telemetry metadata ${key} of event ${event} expected a value of type Date or string ` +
|
|
|
|
`but received a value of type ${typeof value}`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else if (dataType !== typeof value) {
|
|
|
|
throw new Error(
|
|
|
|
`Telemetry metadata ${key} of event ${event} expected a value of type ${dataType} ` +
|
|
|
|
`but received a value of type ${typeof value}`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export type TelemetryEventChecker = (event: TelemetryEvent, metadata?: TelemetryMetadata) => void;
|