Set<MetricEvent> (@NotNull Project project) { Map<? extends JpsModuleSourceRootType<?>, String> typeNames = JBIterable.from(JpsModelSerializerExtension.getExtensions()) .filter(o -> PluginInfoDetectorKt.getPluginInfo(o.getClass()).isDevelopedByJetBrains()) .flatMap(JpsModelSerializerExtension::getModuleSourceRootPropertiesSerializers) .toMap(JpsElementPropertiesSerializer::getType, JpsElementPropertiesSerializer::getTypeId); int contentRoots = 0, sourceRoots = 0, excludedRoots = 0, packagePrefix = 0; Object2IntMap<String> types = new Object2IntOpenHashMap<>(); ModuleManager moduleManager = ModuleManager.getInstance(project); Module[] modules = moduleManager.getModules(); Set<List<String>> moduleGroups = new HashSet<>(); for (Module module : modules) { ModuleRootManager rootManager = ModuleRootManager.getInstance(module); contentRoots += rootManager.getContentEntries().length; sourceRoots += rootManager.getSourceRoots(true).length; excludedRoots += rootManager.getExcludeRoots().length; for (ContentEntry entry : rootManager.getContentEntries()) { for (SourceFolder source : entry.getSourceFolders()) { if (StringUtil.isNotEmpty(source.getPackagePrefix())) { packagePrefix++; } String key = typeNames.get(source.getRootType()); if (key == null) { continue; } types.mergeInt(key, 1, Math::addExact); } } String[] groupPath = moduleManager.getModuleGroupPath(module); if (groupPath != null) { moduleGroups.add(Arrays.asList(groupPath)); } } final Set<MetricEvent> result = new HashSet<>(); result.add(MODULES_TOTAL.metric(modules.length)); result.add(MODULE_GROUPS_TOTAL.metric(moduleGroups.size())); result.add(UNLOADED_MODULES_TOTAL.metric(moduleManager.getUnloadedModuleDescriptions().size())); result.add(CONTENT_ROOTS_TOTAL.metric(contentRoots)); result.add(SOURCE_ROOTS_TOTAL.metric(sourceRoots)); result.add(EXCLUDED_ROOTS_TOTAL.metric(excludedRoots)); for (Object2IntMap.Entry<String> entry : types.object2IntEntrySet()) { result.add(SOURCE_ROOT.metric(entry.getIntValue(), entry.getKey())); } if (PlatformUtils.isIntelliJ()) { result.add(PACKAGE_PREFIX.metric(packagePrefix)); } NamedScope[] localScopes = NamedScopeManager.getInstance(project).getEditableScopes(); result.add(NAMED_SCOPES_TOTAL_LOCAL.metric(localScopes.length)); NamedScope[] sharedScopes = DependencyValidationManager.getInstance(project).getEditableScopes(); result.add(NAMED_SCOPES_TOTAL_SHARED.metric(sharedScopes.length)); String basePath = project.getBasePath(); if (basePath != null && WslPath.isWslUncPath(basePath)) { result.add(PROJECT_IN_WSL.metric()); } return result; }