Fix add-entry span duration (#29288)

Currently the span is finished on seal but that's not the actual timing where the entry span is finished as there's a `succeedEntry` hook. This PR changes the span to finish on `succeedEntry`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
This commit is contained in:
Tim Neutkens 2021-09-23 00:30:51 +02:00 committed by GitHub
parent ead56eaab6
commit 0d4e4e9092
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,19 +179,19 @@ export class ProfilingPlugin {
{ parentSpan: () => spans.get(compilation)! }
)
this.traceHookPair(
'add-entry',
compilation.hooks.addEntry,
compilation.hooks.afterSeal,
{
attrs: (entry: any) => {
return {
request: entry.request,
}
},
parentSpan: () => spans.get(compilation)!,
compilation.hooks.addEntry.tap(pluginName, (entry: any) => {
const compilationSpan = spans.get(compilation)
if (!compilationSpan) {
return
}
)
const addEntrySpan = compilationSpan.traceChild('add-entry')
addEntrySpan.setAttribute('request', entry.request)
spans.set(entry, addEntrySpan)
})
compilation.hooks.succeedEntry.tap(pluginName, (entry: any) => {
spans.get(entry)?.stop()
})
}
this.traceHookPair(