Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apphosting emulator: Metrics #7965

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
4 changes: 4 additions & 0 deletions src/apphosting/yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
}

const file = await readFileFromDirectory(dirname(filePath), basename(filePath));
const loadedAppHostingYaml = (await wrappedSafeLoad(file.source)) ?? {};

Check warning on line 32 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

if (loadedAppHostingYaml.env) {

Check warning on line 34 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .env on an `any` value
const parsedEnvs = parseEnv(loadedAppHostingYaml.env);

Check warning on line 35 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe argument of type `any` assigned to a parameter of type `Env[]`

Check warning on line 35 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .env on an `any` value
config._environmentVariables = parsedEnvs.environmentVariables;
config._secrets = parsedEnvs.secrets;
}
Expand All @@ -44,7 +44,7 @@
* Simply returns an empty AppHostingYamlConfig (no environment variables
* or secrets).
*/
static empty() {

Check warning on line 47 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
return new AppHostingYamlConfig();
}

Expand All @@ -61,19 +61,23 @@
return mapToArray(this._secrets);
}

addEnvironmentVariable(env: EnvironmentVariable) {

Check warning on line 64 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
this._environmentVariables.set(env.variable, env);
}

addSecret(secret: Secret) {

Check warning on line 68 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
this._secrets.set(secret.variable, secret);
}

resetSecrets() {

Check warning on line 72 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
this._secrets.clear();
}

/**
* Merges this AppHostingYamlConfig with another config, the incoming config
* has precedence if there are any conflicting configurations.
* */

Check warning on line 79 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Should be no multiple asterisks on end lines
merge(other: AppHostingYamlConfig) {

Check warning on line 80 in src/apphosting/yaml.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
for (const [key, value] of other._environmentVariables) {
this._environmentVariables.set(key, value);
}
Expand Down
3 changes: 3 additions & 0 deletions src/emulator/apphosting/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { trackGA4 } from "../../track";
import { EmulatorInfo, EmulatorInstance, Emulators } from "../types";
import { start as apphostingStart } from "./serve";
import { logger } from "./developmentServer";
Expand All @@ -23,6 +24,8 @@ export class AppHostingEmulator implements EmulatorInstance {
});
this.args.options.host = hostname;
this.args.options.port = port;

void trackGA4("apphosting_backends_emulated", {});
}

connect(): Promise<void> {
Expand Down
3 changes: 2 additions & 1 deletion src/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ type cliEventNames =
| "extensions_emulated"
| "function_deploy"
| "codebase_deploy"
| "function_deploy_group";
| "function_deploy_group"
| "apphosting_backends_emulated";
type GA4Property = "cli" | "emulator" | "vscode";
interface GA4Info {
measurementId: string;
Expand Down
Loading