Skip to content

Commit

Permalink
fix compilation relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Sep 17, 2021
1 parent 367f8d6 commit 6d6addc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/next/build/webpack/plugins/profiling-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ProfilingPlugin {
}: {
parentSpan?: () => Span
attrs?: any
onStart?: (span: Span) => void
onStart?: (span: Span, ...params: any[]) => void
onStop?: () => void
} = {}
) {
Expand All @@ -51,7 +51,7 @@ export class ProfilingPlugin {
? parentSpan().traceChild(name, attributes)
: this.runWebpackSpan.traceChild(name, attributes)

if (onStart) onStart(span)
if (onStart) onStart(span, ...params)
})
stopHook.tap(pluginName, () => {
// `stopHook` may be triggered when `startHook` has not in cases
Expand All @@ -75,7 +75,7 @@ export class ProfilingPlugin {
parentSpan: () =>
webpackInvalidSpans.get(compiler) || this.runWebpackSpan,
attrs: () => ({ name: compiler.name }),
onStart: (span) => spans.set(compiler, span),
onStart: (span, compilation) => spans.set(compilation, span),
}
)

Expand Down Expand Up @@ -115,8 +115,8 @@ export class ProfilingPlugin {

compiler.hooks.compilation.tap(pluginName, (compilation: any) => {
compilation.hooks.buildModule.tap(pluginName, (module: any) => {
const compilerSpan = spans.get(compiler)
if (!compilerSpan) {
const compilationSpan = spans.get(compilation)
if (!compilationSpan) {
return
}

Expand All @@ -138,7 +138,7 @@ export class ProfilingPlugin {
if (issuerSpan) {
span = issuerSpan.traceChild(spanName)
} else {
span = compilerSpan.traceChild(spanName)
span = compilationSpan.traceChild(spanName)
}
span.setAttribute('name', module.userRequest)
spans.set(module, span)
Expand Down

0 comments on commit 6d6addc

Please sign in to comment.