IDEA-345401 Track duration of health check

GitOrigin-RevId: 71b94fc4f8d85985b3735a1165478d97788124ce
This commit is contained in:
Liudmila Kornilova
2024-03-21 21:38:51 +00:00
committed by intellij-monorepo-bot
parent d5e6e71cab
commit 56bf3f8534
2 changed files with 7 additions and 1 deletions
@@ -11,7 +11,7 @@ import com.intellij.openapi.project.Project
*/
internal object IndexableFilesFilterHealthCheckCollector : CounterUsagesCollector() {
private val GROUP = EventLogGroup("indexable.files.filter",
6,
7,
"FUS",
"Collects statistics of ProjectIndexableFilesFilterHealthCheck. " +
"See more here: https://youtrack.jetbrains.com/articles/IJPL-A-300/indexable.files.filter")
@@ -21,6 +21,7 @@ internal object IndexableFilesFilterHealthCheckCollector : CounterUsagesCollecto
private val filterNameField = EventFields.StringValidatedByEnum("filter_name", "indexable_files_filter_name")
private val attemptNumberInProjectField = EventFields.Int("attempt_number_in_project", "Health check attempt number in a given project. First is 1.")
private val successfulAttemptNumberInProjectField = EventFields.Int("successful_attempt_number_in_project", "Finished (not-cancelled) health check attempt number in a given project. First is 1.")
private val durationMsFiled = EventFields.Int("duration_ms", "Health check duration in milliseconds")
private val nonIndexableFilesInFilterField = EventFields.Int("non_indexable_files_in_filter_count")
private val indexableFilesNotInFilterField = EventFields.Int("indexable_files_not_in_filter_count")
@@ -30,6 +31,7 @@ internal object IndexableFilesFilterHealthCheckCollector : CounterUsagesCollecto
filterNameField,
attemptNumberInProjectField,
successfulAttemptNumberInProjectField,
durationMsFiled,
nonIndexableFilesInFilterField,
indexableFilesNotInFilterField,
)
@@ -56,6 +58,7 @@ internal object IndexableFilesFilterHealthCheckCollector : CounterUsagesCollecto
filter: ProjectIndexableFilesFilter,
attemptNumber: Int,
successfulAttemptNumber: Int,
durationMs: Int,
nonIndexableFilesInFilterCount: Int,
indexableFilesNotInFilterCount: Int) {
indexableFilesFilterHealthCheck.log(
@@ -63,6 +66,7 @@ internal object IndexableFilesFilterHealthCheckCollector : CounterUsagesCollecto
filterNameField.with(getFilterName(filter)),
attemptNumberInProjectField.with(attemptNumber),
successfulAttemptNumberInProjectField.with(successfulAttemptNumber),
durationMsFiled.with(durationMs),
nonIndexableFilesInFilterField.with(nonIndexableFilesInFilterCount),
indexableFilesNotInFilterField.with(indexableFilesNotInFilterCount),
)
@@ -96,6 +96,7 @@ class ProjectIndexableFilesFilterHealthCheck(private val project: Project, priva
try {
val attemptNumber = attemptsCount.incrementAndGet()
IndexableFilesFilterHealthCheckCollector.reportIndexableFilesFilterHealthcheckStarted(project, filter, attemptNumber)
val startTime = System.currentTimeMillis()
Observation.awaitConfiguration(project) // wait for project import IDEA-348501
val (nonIndexableFilesInFilter, indexableFilesNotInFilter) = smartReadAction(project) {
@@ -110,6 +111,7 @@ class ProjectIndexableFilesFilterHealthCheck(private val project: Project, priva
filter,
attemptNumber,
successfulAttemptsCount.incrementAndGet(),
(System.currentTimeMillis() - startTime).toInt(),
nonIndexableFilesInFilter.size,
indexableFilesNotInFilter.size)