Unverified Commit 9ab17091 authored by Keen Yee Liau's avatar Keen Yee Liau Committed by GitHub

telemetry: track usage of 'optimizeFonts' (#31522)

`optimizeFonts` is enabled by default, but the Aurora team would like
to find out how many users explicitly turn it off.
parent b80c3789
......@@ -1350,14 +1350,24 @@ export default async function build(
)
}
const optimizeCss: EventBuildFeatureUsage = {
featureName: 'experimental/optimizeCss',
invocationCount: config.experimental.optimizeCss ? 1 : 0,
}
telemetry.record({
eventName: EVENT_BUILD_FEATURE_USAGE,
payload: optimizeCss,
})
const features: EventBuildFeatureUsage[] = [
{
featureName: 'experimental/optimizeCss',
invocationCount: config.experimental.optimizeCss ? 1 : 0,
},
{
featureName: 'optimizeFonts',
invocationCount: config.optimizeFonts ? 1 : 0,
},
]
telemetry.record(
features.map((feature) => {
return {
eventName: EVENT_BUILD_FEATURE_USAGE,
payload: feature,
}
})
)
await promises.writeFile(
path.join(distDir, SERVER_FILES_MANIFEST),
......
......@@ -131,6 +131,7 @@ export type EventBuildFeatureUsage = {
| 'next/script'
| 'next/dynamic'
| 'experimental/optimizeCss'
| 'optimizeFonts'
| 'swcLoader'
| 'swcMinify'
invocationCount: number
......
......@@ -575,6 +575,9 @@ describe('Telemetry CLI', () => {
})
const regex = /NEXT_BUILD_FEATURE_USAGE[\s\S]+?{([\s\S]+?)}/g
regex.exec(stderr).pop() // optimizeCss
const optimizeFonts = regex.exec(stderr).pop()
expect(optimizeFonts).toContain(`"featureName": "optimizeFonts"`)
expect(optimizeFonts).toContain(`"invocationCount": 1`)
const swcLoader = regex.exec(stderr).pop()
expect(swcLoader).toContain(`"featureName": "swcLoader"`)
expect(swcLoader).toContain(`"invocationCount": 1`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment