Unverified Commit 002ed250 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Add name to invalidated span (#29170)

parent 29ab4332
...@@ -28,7 +28,7 @@ export class ProfilingPlugin { ...@@ -28,7 +28,7 @@ export class ProfilingPlugin {
} }
traceHookPair( traceHookPair(
spanName: string, spanName: string | (() => string),
startHook: any, startHook: any,
stopHook: any, stopHook: any,
{ {
...@@ -45,13 +45,11 @@ export class ProfilingPlugin { ...@@ -45,13 +45,11 @@ export class ProfilingPlugin {
) { ) {
let span: Span | undefined let span: Span | undefined
startHook.tap(pluginName, (...params: any[]) => { startHook.tap(pluginName, (...params: any[]) => {
const name = typeof spanName === 'function' ? spanName() : spanName
const attributes = attrs ? attrs(...params) : attrs const attributes = attrs ? attrs(...params) : attrs
if (spanName === 'webpack-invalidated' && attributes.name === 'client') {
debugger
}
span = parentSpan span = parentSpan
? parentSpan().traceChild(spanName, attributes) ? parentSpan().traceChild(name, attributes)
: this.runWebpackSpan.traceChild(spanName, attributes) : this.runWebpackSpan.traceChild(name, attributes)
if (onStart) onStart(span) if (onStart) onStart(span)
}) })
...@@ -83,14 +81,13 @@ export class ProfilingPlugin { ...@@ -83,14 +81,13 @@ export class ProfilingPlugin {
if (compiler.options.mode === 'development') { if (compiler.options.mode === 'development') {
this.traceHookPair( this.traceHookPair(
'webpack-invalidated', () => `webpack-invalidated-${compiler.name}`,
compiler.hooks.invalid, compiler.hooks.invalid,
compiler.hooks.done, compiler.hooks.done,
{ {
onStart: (span) => webpackInvalidSpans.set(compiler, span), onStart: (span) => webpackInvalidSpans.set(compiler, span),
onStop: () => webpackInvalidSpans.delete(compiler), onStop: () => webpackInvalidSpans.delete(compiler),
attrs: (fileName: any) => ({ attrs: (fileName: any) => ({
name: compiler.name,
trigger: fileName || 'manual', trigger: fileName || 'manual',
}), }),
} }
......
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