IDEA-322347 Add statistics

GitOrigin-RevId: 5f5432b6eb6cd74138d661f51914cc58a97f7eba
This commit is contained in:
Mikhail Sokolov
2023-07-07 13:57:08 +02:00
committed by intellij-monorepo-bot
parent 9641e48395
commit cd5ea9ddfc
3 changed files with 15 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.actions.searcheverywhere;
import com.intellij.ide.actions.searcheverywhere.statistics.SearchEverywhereUsageTriggerCollector;
import com.intellij.util.Range;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -131,6 +132,11 @@ class GroupedSearchListModel extends SearchListModel {
if (!alreadyHas && newVal) {
index += 1;
int elementsCount = index - contributors().indexOf(contributor);
SearchEverywhereUsageTriggerCollector.MORE_ITEM_SHOWN.log(
SearchEverywhereUsageTriggerCollector.ITEM_NUMBER_BEFORE_MORE.with(elementsCount),
SearchEverywhereUsageTriggerCollector.IS_ONLY_MORE.with(false)
);
listElements.add(index, new SearchEverywhereFoundElementInfo(MORE_ELEMENT, 0, contributor));
fireIntervalAdded(this, index, index);
}

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.actions.searcheverywhere;
import com.intellij.ide.actions.searcheverywhere.statistics.SearchEverywhereUsageTriggerCollector;
import com.intellij.openapi.util.Conditions;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
@@ -118,6 +119,10 @@ class MixedSearchListModel extends SearchListModel {
}
if (!alreadyHas && hasMore) {
SearchEverywhereUsageTriggerCollector.MORE_ITEM_SHOWN.log(
SearchEverywhereUsageTriggerCollector.ITEM_NUMBER_BEFORE_MORE.with(listElements.size()),
SearchEverywhereUsageTriggerCollector.IS_ONLY_MORE.with(true)
);
listElements.add(new SearchEverywhereFoundElementInfo(MORE_ELEMENT, 0, null));
lasItemIndex += 1;
fireIntervalAdded(this, lasItemIndex, lasItemIndex);

View File

@@ -42,7 +42,7 @@ public final class SearchEverywhereUsageTriggerCollector extends CounterUsagesCo
"third.party", "Vcs.Git");
public static final StringEventField CURRENT_TAB_FIELD = EventFields.String("currentTabId", ourTabs);
private static final EventLogGroup GROUP = new EventLogGroup("searchEverywhere", 9);
private static final EventLogGroup GROUP = new EventLogGroup("searchEverywhere", 10);
public static final EventId2<String, AnActionEvent> DIALOG_OPEN = GROUP.registerEvent("dialogOpen",
CONTRIBUTOR_ID_FIELD,
@@ -59,6 +59,9 @@ public final class SearchEverywhereUsageTriggerCollector extends CounterUsagesCo
EventFields.Language, CURRENT_TAB_FIELD,
SELECTED_ITEM_NUMBER);
public static final EventId MORE_ITEM_SELECTED = GROUP.registerEvent("moreItemChosen");
public static final IntEventField ITEM_NUMBER_BEFORE_MORE = EventFields.Int("itemsNumberBeforeMore");
public static final BooleanEventField IS_ONLY_MORE = EventFields.Boolean("isOnlyMore");
public static final VarargEventId MORE_ITEM_SHOWN = GROUP.registerVarargEvent("moreItemShown", ITEM_NUMBER_BEFORE_MORE, IS_ONLY_MORE);
public static final EventId COMMAND_USED = GROUP.registerEvent("commandUsed");
public static final VarargEventId COMMAND_COMPLETED = GROUP.registerVarargEvent("commandCompleted",