From f28b965add39d1f83e267e196fb098cdfce41ce3 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Mon, 16 Aug 2021 22:05:57 +0200 Subject: [PATCH] Add module type to build-module trace (#28128) Add `-js` `-ts` `-tsx` `-css` to `build-module` in traces to allow for easier filtering. ## 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 --- .../next/build/webpack/plugins/profiling-plugin.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/next/build/webpack/plugins/profiling-plugin.ts b/packages/next/build/webpack/plugins/profiling-plugin.ts index a091ec83a35153a..1e98defdef0392c 100644 --- a/packages/next/build/webpack/plugins/profiling-plugin.ts +++ b/packages/next/build/webpack/plugins/profiling-plugin.ts @@ -99,7 +99,18 @@ export class ProfilingPlugin { return } - const span = trace('build-module', compilerSpan.id) + const moduleType = (() => { + if (!module.userRequest) { + return '' + } + + return module.userRequest.split('.').pop() + })() + + const span = trace( + `build-module${moduleType ? `-${moduleType}` : ''}`, + compilerSpan.id + ) span.setAttribute('name', module.userRequest) spans.set(module, span) })