[stats-collector] update ClientSessionValidator to new api

GitOrigin-RevId: 1e152b01c0597483023cfbd47d5381cefe1b8439
This commit is contained in:
Alexey Kalina
2020-09-16 07:40:37 +00:00
committed by intellij-monorepo-bot
parent 7f06d7ab05
commit 53b27e84fe
3 changed files with 12 additions and 14 deletions
@@ -17,13 +17,13 @@
<orderEntry type="library" name="gson" level="project" />
<orderEntry type="module-library">
<library name="completion-log-events" type="repository">
<properties include-transitive-deps="false" maven-id="org.jetbrains.intellij.deps.completion:completion-log-events:0.0.2" />
<properties include-transitive-deps="false" maven-id="org.jetbrains.intellij.deps.completion:completion-log-events:0.0.3" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/completion/completion-log-events/0.0.2/completion-log-events-0.0.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/completion/completion-log-events/0.0.3/completion-log-events-0.0.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/completion/completion-log-events/0.0.2/completion-log-events-0.0.2-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/completion/completion-log-events/0.0.3/completion-log-events-0.0.3-sources.jar!/" />
</SOURCES>
</library>
</orderEntry>
@@ -16,13 +16,13 @@
<orderEntry type="module" module-name="intellij.completionMlRanking" scope="TEST" />
<orderEntry type="module-library" scope="TEST">
<library name="completion-log-events" type="repository">
<properties include-transitive-deps="false" maven-id="org.jetbrains.intellij.deps.completion:completion-log-events:0.0.2" />
<properties include-transitive-deps="false" maven-id="org.jetbrains.intellij.deps.completion:completion-log-events:0.0.3" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/completion/completion-log-events/0.0.2/completion-log-events-0.0.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/completion/completion-log-events/0.0.3/completion-log-events-0.0.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/completion/completion-log-events/0.0.2/completion-log-events-0.0.2-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/completion/completion-log-events/0.0.3/completion-log-events-0.0.3-sources.jar!/" />
</SOURCES>
</library>
</orderEntry>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2018 JetBrains s.r.o.
* Copyright 2000-2020 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,20 +17,18 @@
package com.intellij.stats.completion.logger
import com.intellij.stats.completion.LogEventSerializer
import com.intellij.stats.completion.ValidationStatus
import com.intellij.stats.completion.events.LogEvent
import com.intellij.stats.validation.InputSessionValidator
import com.intellij.stats.validation.SimpleSessionValidationResult
/**
* @author Vitaliy.Bibaev
*/
class ClientSessionValidator : SessionValidator {
private val validator: InputSessionValidator = InputSessionValidator()
override fun validate(session: List<LogEvent>) {
val validationResult = SimpleSessionValidationResult()
val line2event = session.associateTo(linkedMapOf(), { LogEventSerializer.toString(it) to it })
InputSessionValidator(validationResult).validate(line2event.keys.toList())
validationResult.errorLines.forEach { line2event[it]!!.validationStatus = ValidationStatus.INVALID }
validationResult.validLines.forEach { line2event[it]!!.validationStatus = ValidationStatus.VALID }
val lines = session.map { LogEventSerializer.toString(it) }
val result = validator.validate(lines)
session.forEach { it.validationStatus = result.validationStatus }
}
}