Skip to content

Commit a93f97c

Browse files
vaadin-botmshabarovtepimanolo
authored
feat: Add app vs default dev-bundle statistics (#16103) (#16121)
* feat: Add app vs default dev-bundle statistics * add statistics about re-bundling reason * Better names --------- Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com> Co-authored-by: Teppo Kurki <teppo.kurki@vaadin.com> Co-authored-by: Manuel Carrasco Moñino <manolo@vaadin.com>
1 parent bf5e112 commit a93f97c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeTasks.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ public NodeTasks(Options options) {
9595

9696
final FeatureFlags featureFlags = options.getFeatureFlags();
9797

98+
if (options.isFrontendHotdeploy()) {
99+
UsageStatistics.markAsUsed("flow/hotdeploy", null);
100+
}
101+
98102
if (options.isEnablePackagesUpdate() || options.isEnableImportsUpdate()
99103
|| options.isEnableWebpackConfigUpdate()) {
100104
frontendDependencies = new FrontendDependenciesScanner.FrontendDependenciesScannerFactory()
@@ -106,14 +110,21 @@ public NodeTasks(Options options) {
106110
// determine if we need a rebuild as the check happens immediately
107111
// and no update tasks are executed before it.
108112
if (!options.isProductionMode() && options.isDevBundleBuild()) {
109-
UsageStatistics.markAsUsed("flow/expressBuild", null);
110113
if (TaskRunDevBundleBuild.needsBuild(options,
111114
frontendDependencies, classFinder)) {
112115
options.withRunNpmInstall(true);
113116
options.withCopyTemplates(true);
117+
UsageStatistics.markAsUsed("flow/app-dev-bundle", null);
114118
} else {
115119
// A dev bundle build is not needed after all, skip it
116120
options.withDevBundleBuild(false);
121+
File devBundleFolder = FrontendUtils
122+
.getDevBundleFolder(options.getNpmFolder());
123+
if (devBundleFolder.exists()) {
124+
UsageStatistics.markAsUsed("flow/app-dev-bundle", null);
125+
} else {
126+
UsageStatistics.markAsUsed("flow/dev-bundle", null);
127+
}
117128
}
118129
}
119130

flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskRunDevBundleBuild.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.vaadin.flow.component.WebComponentExporterFactory;
4646
import com.vaadin.flow.internal.JsonUtils;
4747
import com.vaadin.flow.internal.StringUtil;
48+
import com.vaadin.flow.internal.UsageStatistics;
4849
import com.vaadin.flow.server.Constants;
4950
import com.vaadin.flow.server.ExecutionFailedException;
5051
import com.vaadin.flow.server.frontend.scanner.ClassFinder;
@@ -182,21 +183,29 @@ protected static boolean needsBuildInternal(Options options,
182183
.getPackages();
183184

184185
if (!hashAndBundleModulesEqual(statsJson, packageJson, npmPackages)) {
186+
UsageStatistics.markAsUsed("flow/rebundle-reason-missing-package",
187+
null);
185188
// Hash in the project doesn't match the bundle hash or NpmPackages
186189
// are found missing in bundle.
187190
return true;
188191
}
189192
if (!frontendImportsFound(statsJson, options, finder,
190193
frontendDependencies)) {
194+
UsageStatistics.markAsUsed(
195+
"flow/rebundle-reason-missing-frontend-import", null);
191196
return true;
192197
}
193198

194199
if (themeConfigurationChanged(options, statsJson,
195200
frontendDependencies)) {
201+
UsageStatistics.markAsUsed(
202+
"flow/rebundle-reason-changed-theme-config", null);
196203
return true;
197204
}
198205

199206
if (exportedWebComponents(statsJson, finder)) {
207+
UsageStatistics.markAsUsed(
208+
"flow/rebundle-reason-added-exported-component", null);
200209
return true;
201210
}
202211

0 commit comments

Comments
 (0)