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

Count the number of regions deployed to #3948

Merged
merged 3 commits into from Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/deploy/functions/release/reporter.ts
Expand Up @@ -59,8 +59,10 @@ export async function logAndTrackDeployStats(summary: Summary): Promise<void> {
let totalAborts = 0;
const reports: Array<Promise<void>> = [];

const regions = new Set<string>();
for (const result of summary.results) {
const tag = triggerTag(result.endpoint);
regions.add(result.endpoint.region);
totalTime += result.durationMs;
if (!result.error) {
totalSuccesses++;
Expand All @@ -74,6 +76,9 @@ export async function logAndTrackDeployStats(summary: Summary): Promise<void> {
}
}

const regionCountTag = regions.size < 5 ? regions.size.toString() : ">=5";
reports.push(track.track("functions_region_count", regionCountTag, 1));

const gcfv1 = summary.results.find((r) => r.endpoint.platform === "gcfv1");
const gcfv2 = summary.results.find((r) => r.endpoint.platform === "gcfv2");
const tag = gcfv1 && gcfv2 ? "v1+v2" : gcfv1 ? "v1" : "v2";
Expand Down
1 change: 1 addition & 0 deletions src/test/deploy/functions/release/reporter.spec.ts
Expand Up @@ -132,6 +132,7 @@ describe("reporter", () => {

await reporter.logAndTrackDeployStats(summary);

expect(trackStub).to.have.been.calledWith("functions_region_count", "1", 1);
expect(trackStub).to.have.been.calledWith("function_deploy_success", "v1.https", 2_000);
expect(trackStub).to.have.been.calledWith("function_deploy_failure", "v1.https", 1_000);
// Aborts aren't tracked because they would throw off timing metrics
Expand Down