mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Enabling telemetry on /api/version endpoint
Summary: Version API endpoint wasn't logging telemetry from POST requests. The issue was in registration order, this endpoint was registered before `expressJson` and it couldn't read json body in the handler. Test Plan: Added new test Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4277
This commit is contained in:
@@ -1971,7 +1971,7 @@ export class FlexServer implements GristServer {
|
||||
}
|
||||
|
||||
public addUpdatesCheck() {
|
||||
if (this._check('update')) { return; }
|
||||
if (this._check('update', 'json')) { return; }
|
||||
|
||||
// For now we only are active for sass deployments.
|
||||
if (this._deploymentType !== 'saas') { return; }
|
||||
|
||||
@@ -85,15 +85,12 @@ export class UpdateManager {
|
||||
const payload = (name: string) => req.body?.[name] ?? req.query[name];
|
||||
|
||||
// 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.
|
||||
const deploymentId = optStringParam(
|
||||
payload("installationId"),
|
||||
"installationId"
|
||||
);
|
||||
|
||||
// Current version of grist-core part of the client. Currently not used and not
|
||||
// passed from the client.
|
||||
|
||||
// Deployment type of the client (we expect this to be 'core' for most of the cases).
|
||||
const deploymentType = optStringParam(
|
||||
payload("deploymentType"),
|
||||
|
||||
@@ -106,7 +106,6 @@ export async function main(port: number, serverTypes: ServerType[],
|
||||
server.addHealthCheck();
|
||||
if (includeHome || includeApp) {
|
||||
server.addBootPage();
|
||||
server.addUpdatesCheck();
|
||||
}
|
||||
server.denyRequestsIfNotReady();
|
||||
|
||||
@@ -148,6 +147,7 @@ export async function main(port: number, serverTypes: ServerType[],
|
||||
server.addDocApiForwarder();
|
||||
}
|
||||
server.addJsonSupport();
|
||||
server.addUpdatesCheck();
|
||||
await server.addLandingPages();
|
||||
// todo: add support for home api to standalone app
|
||||
server.addHomeApi();
|
||||
|
||||
Reference in New Issue
Block a user