Skip to content

Commit

Permalink
cleanup opportunities
Browse files Browse the repository at this point in the history
  • Loading branch information
max-ostapenko committed Jan 12, 2025
1 parent cddd35c commit a118060
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions definitions/output/core_web_vitals/technologies.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,6 @@ CREATE TEMP FUNCTION IS_NON_ZERO(
) RETURNS BOOL AS (
good + needs_improvement + poor > 0
);
CREATE TEMP FUNCTION extract_audits (lighthouse JSON)
RETURNS ARRAY<STRUCT<
id STRING,
savings_ms INT64,
savings_bytes INT64
>>
LANGUAGE js AS """
const results = []
const performance_audits = lighthouse?.categories ? lighthouse.categories.performance.auditRefs
.filter((audit) => audit.group === "diagnostics")
.map((audit) => audit.id) : null
if(performance_audits) {
for (const [key, audit] of Object.entries(lighthouse.audits)) {
if (
performance_audits.includes(audit.id) &&
audit.score !== null &&
audit.scoreDisplayMode === 'metricSavings'
) {
results.push({
id: audit.id,
savings_ms: audit?.details?.overallSavingsMs || audit?.numericUnit === 'millisecond' ? audit.numericValue : null,
savings_bytes: audit?.details?.overallSavingsBytes || audit?.numericUnit === 'byte' ? audit.numericValue : null,
})
}
}
return results;
} else {
return null;
}
""";
`).query(ctx => `
WITH pages AS (
SELECT
Expand Down Expand Up @@ -228,7 +196,6 @@ lab_metrics AS (
SAFE.FLOAT64(lighthouse.categories.performance.score) AS performance,
SAFE.FLOAT64(lighthouse.categories.pwa.score) AS pwa,
SAFE.FLOAT64(lighthouse.categories.seo.score) AS seo,
extract_audits(lighthouse) AS performance_opportunities,
FROM pages
),
Expand Down

0 comments on commit a118060

Please sign in to comment.