Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/deploy/extensions/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export interface Payload {
export interface Context {
have?: planner.DeploymentInstanceSpec[];
want?: planner.DeploymentInstanceSpec[];
extensionsStartTime?: number;
}
1 change: 0 additions & 1 deletion src/deploy/extensions/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export async function deploy(context: Context, options: Options, payload: Payloa

validationQueue.process();
validationQueue.close();

await validationPromise;

if (errorHandler.hasErrors()) {
Expand Down
1 change: 1 addition & 0 deletions src/deploy/extensions/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { checkSpecForV2Functions, ensureNecessaryV2ApisAndRoles } from "./v2Func
import { acceptLatestAppDeveloperTOS } from "../../extensions/tos";

export async function prepare(context: Context, options: Options, payload: Payload) {
context.extensionsStartTime = Date.now();
const projectId = needProjectId(options);
const projectNumber = await needProjectNumber(options);
const aliases = getAliases(options, projectId);
Expand Down
15 changes: 15 additions & 0 deletions src/deploy/extensions/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ErrorHandler } from "./errors";
import { Options } from "../../options";
import { needProjectId } from "../../projectUtils";
import { saveEtags } from "../../extensions/etags";
import { trackGA4 } from "../../track";

export async function release(context: Context, options: Options, payload: Payload) {
const projectId = needProjectId(options);
Expand Down Expand Up @@ -45,6 +46,20 @@ export async function release(context: Context, options: Options, payload: Paylo
deploymentQueue.close();

await deploymentPromise;
// extensionsStartTime should always be populated, but if not, fall back to something that won't break us.
const duration = context.extensionsStartTime ? Date.now() - context.extensionsStartTime : 1;
await trackGA4(
"extensions_deploy",
{
extension_instance_created: payload.instancesToCreate?.length ?? 0,
extension_instance_updated: payload.instancesToUpdate?.length ?? 0,
extension_instance_configured: payload.instancesToConfigure?.length ?? 0,
extension_instance_deleted: payload.instancesToDelete?.length ?? 0,
errors: errorHandler.errors.length ?? 0,
interactive: options.nonInteractive ? "false" : "true",
},
duration
);

// After deployment, write the latest etags to RC so we can detect out of band changes in the next deploy.
const newHave = await planner.have(projectId);
Expand Down
6 changes: 0 additions & 6 deletions src/deploy/hosting/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Uploader } from "./uploader";
import { detectProjectRoot } from "../../detectProjectRoot";
import { listFiles } from "../../listFiles";
import { logger } from "../../logger";
import { track } from "../../track";
import { envOverride, logLabeledBullet, logLabeledSuccess } from "../../utils";
import { bold, cyan } from "colorette";
import * as ora from "ora";
Expand Down Expand Up @@ -88,9 +87,6 @@ export async function deploy(context: Context, options: Options): Promise<void>

try {
await uploader.start();
} catch (err: any) {
void track("Hosting Deploy", "failure");
throw err;
} finally {
clearInterval(progressInterval);
updateSpinner(uploader.statusMessage(), debugging);
Expand All @@ -103,8 +99,6 @@ export async function deploy(context: Context, options: Options): Promise<void>
logLabeledSuccess(`hosting[${deploy.config.site}]`, "file upload complete");
const dt = Date.now() - t0;
logger.debug(`[hosting] deploy completed after ${dt}ms`);

void track("Hosting Deploy", "success", dt);
return runDeploys(deploys, debugging);
}

Expand Down
6 changes: 5 additions & 1 deletion src/emulator/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from "path";
import * as fsConfig from "../firestore/fsConfig";

import { logger } from "../logger";
import { trackEmulator } from "../track";
import { trackEmulator, trackGA4 } from "../track";
import * as utils from "../utils";
import { EmulatorRegistry } from "./registry";
import {
Expand Down Expand Up @@ -351,6 +351,10 @@ export async function startAll(
extensionsBackends
);
emulatableBackends.push(...filteredExtensionsBackends);
trackGA4("extensions_emulated", {
number_of_extensions_emulated: filteredExtensionsBackends.length,
number_of_extensions_ignored: extensionsBackends.length - filteredExtensionsBackends.length,
});
}

const listenConfig = {} as Record<PortName, EmulatorListenConfig>;
Expand Down
4 changes: 3 additions & 1 deletion src/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ type cliEventNames =
| "login"
| "api_enabled"
| "hosting_version"
| "extension_added_to_manifest";
| "extension_added_to_manifest"
| "extensions_deploy"
| "extensions_emulated";
type GA4Property = "cli" | "emulator";
interface GA4Info {
measurementId: string;
Expand Down