(core) Add additional telemetry events

Summary: The new events capture usage of forms, widgets, access rules, and onboarding tours and tips.

Test Plan: Manual.

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4189
This commit is contained in:
George Gevoian
2024-02-13 12:49:00 -05:00
parent 7f9e2817d1
commit b8f32d1784
25 changed files with 483 additions and 55 deletions

View File

@@ -233,7 +233,7 @@ export function attachAppEndpoint(options: AttachOptions): void {
const response = await fetch(formUrl, {
headers: getTransitiveHeaders(req),
});
if (response.status === 200) {
if (response.ok) {
const html = await response.text();
res.send(html);
} else {

View File

@@ -1540,6 +1540,13 @@ export class DocWorkerApi {
SUCCESS_URL: redirectUrl,
TITLE: `${section.title || tableName || tableId || 'Form'} - Grist`
});
this._grist.getTelemetry().logEvent(req, 'visitedForm', {
full: {
docIdDigest: activeDoc.docName,
userId: req.userId,
altSessionId: req.altSessionId,
},
});
res.status(200).send(renderedHtml);
})
);
@@ -2026,6 +2033,7 @@ export class DocWorkerApi {
}
private async _removeDoc(req: Request, res: Response, permanent: boolean) {
const mreq = req as RequestWithLogin;
const scope = getDocScope(req);
const docId = getDocId(req);
if (permanent) {
@@ -2045,6 +2053,13 @@ export class DocWorkerApi {
// Permanently delete from database.
const query = await this._dbManager.deleteDocument(scope);
this._dbManager.checkQueryResult(query);
this._grist.getTelemetry().logEvent(mreq, 'deletedDoc', {
full: {
docIdDigest: docId,
userId: mreq.userId,
altSessionId: mreq.altSessionId,
},
});
await sendReply(req, res, query);
} else {
await this._dbManager.softDeleteDocument(scope);