Set<MetricEvent> (@NotNull Project project) { if (project.isDisposed()) { return Collections.emptySet(); } ProjectFileIndex projectFileIndex = ProjectFileIndex.getInstance(project); IProjectStore stateStore = ProjectKt.getStateStore(project); final ObjectIntMap<FileType> filesByTypeCount = new ObjectIntHashMap<>(); projectFileIndex.iterateContent( file -> { FileType type = file.getFileType(); filesByTypeCount.put(type, filesByTypeCount.getOrDefault(type, 0) + 1); return true; }, //skip files from .idea directory otherwise 99% of projects would have XML and PLAIN_TEXT file types file -> !file.isDirectory() && !stateStore.isProjectFile(file) ); final Set<MetricEvent> events = new HashSet<>(); for (final FileType fileType : filesByTypeCount.keySet()) { List<EventPair<?>> eventPairs = new ArrayList<>(3); eventPairs.add(EventFields.PluginInfoFromInstance.with(fileType)); eventPairs.add(EventFields.FileType.with(fileType)); eventPairs.add(COUNT.with(filesByTypeCount.get(fileType))); events.add(FILE_IN_PROJECT.metric(eventPairs)); } return events; }