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

Add relationship between issuer and module to traces #28192

Merged
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
3 changes: 2 additions & 1 deletion packages/next/build/webpack-config.ts
Expand Up @@ -860,6 +860,7 @@ export default async function getBaseWebpackConfig(
const emacsLockfilePattern = '**/.#*'

let webpackConfig: webpack.Configuration = {
parallelism: Number(process.env.NEXT_WEBPACK_PARALLELISM) || undefined,
externals: !isServer
? // make sure importing "next" is handled gracefully for client
// bundles in case a user imported types and it wasn't removed
Expand Down Expand Up @@ -1309,7 +1310,7 @@ export default async function getBaseWebpackConfig(
new BuildStatsPlugin({
distDir,
}),
new ProfilingPlugin({ runWebpackSpan }),
process.env.TRACE_TARGET && new ProfilingPlugin({ runWebpackSpan }),
config.optimizeFonts &&
!dev &&
isServer &&
Expand Down
4 changes: 3 additions & 1 deletion packages/next/build/webpack/plugins/profiling-plugin.ts
Expand Up @@ -101,9 +101,11 @@ export class ProfilingPlugin {
return module.userRequest.split('.').pop()
})()

const issuerModule = compilation.moduleGraph.getIssuer(module)

const span = trace(
`build-module${moduleType ? `-${moduleType}` : ''}`,
compilerSpan.id
issuerModule ? spans.get(issuerModule)?.id : compilerSpan.id
)
span.setAttribute('name', module.userRequest)
spans.set(module, span)
Expand Down