Skip to content

Commit eef6342

Browse files
authored
Track dynamic IO feature usage (vercel#74942)
Extend https://nextjs.org/telemetry to cover usages of dynamic IO Closes NDX-673
1 parent b44035d commit eef6342

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

packages/next/src/build/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,6 +2674,10 @@ export default async function build(
26742674
}
26752675

26762676
const features: EventBuildFeatureUsage[] = [
2677+
{
2678+
featureName: 'experimental/dynamicIO',
2679+
invocationCount: config.experimental.dynamicIO ? 1 : 0,
2680+
},
26772681
{
26782682
featureName: 'experimental/optimizeCss',
26792683
invocationCount: config.experimental.optimizeCss ? 1 : 0,

packages/next/src/telemetry/events/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export type EventBuildFeatureUsage = {
153153
| 'next/font/google'
154154
| 'next/font/local'
155155
| 'experimental/nextScriptWorkers'
156+
| 'experimental/dynamicIO'
156157
| 'experimental/optimizeCss'
157158
| 'experimental/ppr'
158159
| 'swcLoader'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
experimental: {
3+
dynamicIO: true
4+
}
5+
}

test/integration/telemetry/test/config.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,32 @@ describe('config telemetry', () => {
368368
}
369369
)
370370

371+
it('emits telemetry for usage of `experimental/dynamicIO`', async () => {
372+
await fs.rename(
373+
path.join(appDir, 'next.config.dynamic-io'),
374+
path.join(appDir, 'next.config.js')
375+
)
376+
377+
const { stderr } = await nextBuild(appDir, [], {
378+
stderr: true,
379+
env: { NEXT_TELEMETRY_DEBUG: 1 },
380+
})
381+
382+
await fs.rename(
383+
path.join(appDir, 'next.config.js'),
384+
path.join(appDir, 'next.config.dynamic-io')
385+
)
386+
387+
const events = findAllTelemetryEvents(
388+
stderr,
389+
'NEXT_BUILD_FEATURE_USAGE'
390+
)
391+
expect(events).toContainEqual({
392+
featureName: 'experimental/dynamicIO',
393+
invocationCount: 1,
394+
})
395+
})
396+
371397
it('emits telemetry for usage of `optimizeCss`', async () => {
372398
await fs.rename(
373399
path.join(appDir, 'next.config.optimize-css'),

0 commit comments

Comments
 (0)