[json] IJ-CR-149952 Fix FUS collection errors

- reversed condition
- prefer internal modifiers over annotations

GitOrigin-RevId: 7d1cc8695a85ce54ca7e71fad060b94c662915d1
This commit is contained in:
Nikita Katkov
2024-12-02 14:51:25 +00:00
committed by intellij-monorepo-bot
parent ebeb5cce6b
commit eb480ad535
4 changed files with 7 additions and 14 deletions
@@ -7,12 +7,11 @@ import com.intellij.internal.statistic.eventLog.events.EventFields
import com.intellij.internal.statistic.eventLog.events.RoundedIntEventField
import com.intellij.internal.statistic.eventLog.events.StringEventField
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
import org.jetbrains.annotations.ApiStatus
internal object JsonFeatureUsageCollector : CounterUsagesCollector() {
private val jsonSchemaGroup = EventLogGroup(
id = "json.schema.features",
version = 4,
version = 5,
)
internal val jsonSchemaHighlightingSessionData =
@@ -24,8 +23,7 @@ internal object JsonFeatureUsageCollector : CounterUsagesCollector() {
override fun getGroup(): EventLogGroup = jsonSchemaGroup
}
@ApiStatus.Internal
sealed interface JsonSchemaFusFeature {
internal sealed interface JsonSchemaFusFeature {
val event: EventField<*>
companion object {
@@ -40,16 +38,15 @@ sealed interface JsonSchemaFusFeature {
}
}
enum class JsonSchemaFusAllowedListFeature(override val event: StringEventField) : JsonSchemaFusFeature {
internal enum class JsonSchemaFusAllowedListFeature(override val event: StringEventField) : JsonSchemaFusFeature {
JsonFusSchemaId(EventFields.StringValidatedByCustomRule("schema_id", JsonSchemaIdValidationRule::class.java, "JSON schema ID"))
}
enum class JsonSchemaFusCountedUniqueFeature(override val event: RoundedIntEventField) : JsonSchemaFusFeature {
internal enum class JsonSchemaFusCountedUniqueFeature(override val event: RoundedIntEventField) : JsonSchemaFusFeature {
UniqueRemoteUrlDownloadRequest(EventFields.RoundedInt("unique_remote_url_download_request", "Number of unique remote (URL) references collected during highlighting session")),
}
@ApiStatus.Internal
enum class JsonSchemaFusCountedFeature(override val event: RoundedIntEventField) : JsonSchemaFusFeature {
internal enum class JsonSchemaFusCountedFeature(override val event: RoundedIntEventField) : JsonSchemaFusFeature {
ExecutedHttpVirtualFileDownloadRequest(EventFields.RoundedInt("executed_http_virtual_file_download_request", "Remote (URL) reference download was called)")),
RemoteUrlResolveRequest(EventFields.RoundedInt("remote_url_resolve_request", "Remote (URL) reference resolve was called")),
LocalReferenceResolveRequest(EventFields.RoundedInt("local_file_resolve_request", "Local reference resolve was called")),
@@ -6,11 +6,9 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.thisLogger
import com.jetbrains.jsonSchema.impl.JsonSchemaObject
import kotlinx.coroutines.CancellationException
import org.jetbrains.annotations.ApiStatus
@Service(Service.Level.APP)
@ApiStatus.Internal
class JsonSchemaHighlightingSessionStatisticsCollector {
internal class JsonSchemaHighlightingSessionStatisticsCollector {
companion object {
@JvmStatic
fun getInstance(): JsonSchemaHighlightingSessionStatisticsCollector {
@@ -6,8 +6,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ThreeState;
import com.jetbrains.jsonSchema.fus.JsonSchemaFusCountedFeature;
import com.jetbrains.jsonSchema.fus.JsonSchemaHighlightingSessionStatisticsCollector;
import com.jetbrains.jsonSchema.ide.JsonSchemaService;
import com.jetbrains.jsonSchema.impl.tree.JsonSchemaNodeExpansionRequest;
import com.jetbrains.jsonSchema.impl.tree.Operation;
@@ -12,7 +12,7 @@ internal fun inheritBaseSchemaIfNeeded(parent: JsonSchemaObject, child: JsonSche
?.rootSchemaObject
?.schemaInterpretationStrategy
?.inheritBaseSchema(parent, child)
if (inheritedSchema == null) {
if (inheritedSchema != null) {
JsonSchemaHighlightingSessionStatisticsCollector.getInstance().reportSchemaUsageFeature(JsonSchemaFusCountedFeature.SchemaInherited)
}
return inheritedSchema ?: child