Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reparsing: Add processing time to reparsing index #542

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ data class ReparsingIndexLine(
@Required val timestamp: Long = Instant.now().toEpochMilli(),
@Required val parserVersion: String = Config.getOrDefault("project.version", ""),
val error: String? = null,
var processingTimeMs: Long = 0,
)
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,14 @@ class JavalinApp {
index
.getAll()
.filter { shouldReparse(it, index, !auto, parserVersion) }
.map { async { reparseItem(it, index, store, compression, !auto) } }
.map {
async {
val elapsedTime = measureTimeMillis {
reparseItem(it, index, store, compression, !auto)
}
index.reparsingIndex[it.id]?.processingTimeMs = elapsedTime
}
}
.awaitAll()

index.reparsingIndex.store("$store/reparsing.json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object UtilityForTests {
.collect(Collectors.toList())
}

/** Check if the given directories have the same tree and if files have similar sizes (± 3%) */
/** Check if the given directories have the same tree and if files have similar sizes (± 5%) */
internal fun dirsSimilar(expected: String, actual: String): Boolean {
val pathA = Path(expected)
val pathB = Path(actual)
Expand Down Expand Up @@ -57,7 +57,7 @@ object UtilityForTests {
} else {
val aSize = fileA.readBytes().size
val bSize = fileB.readBytes().size
abs(aSize - bSize) < 3 * aSize / 100
abs(aSize - bSize) < 5 * aSize / 100
}
}
return result
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1730748179933,"parserVersion":"staging"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1730748179903,"parserVersion":"staging"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1731885438628,"parserVersion":"staging","processingTimeMs":20}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1731885438608,"parserVersion":"staging","processingTimeMs":20}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1730748179709,"parserVersion":"staging"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1730748179664,"parserVersion":"staging"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1731885438410,"parserVersion":"staging","processingTimeMs":25}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1731885438386,"parserVersion":"staging","processingTimeMs":54}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417","timestamp":1731876465393,"parserVersion":"staging"}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417","timestamp":1731885437704,"parserVersion":"staging","processingTimeMs":1638}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417-0","timestamp":1730748514633,"parserVersion":"staging"}
10 changes: 5 additions & 5 deletions src/test/resources/server/oracleForReparse/force/reparsing.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1730748180760,"parserVersion":"staging"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1730748180727,"parserVersion":"staging"}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417","timestamp":1730748180199,"parserVersion":"staging"}
{"id":"c3e783c9-54bc-42ee-970c-d871117399b2","timestamp":1730748180660,"parserVersion":"staging"}
{"id":"cd7eb9db-196d-46a5-938d-68061a100cdb","timestamp":1730748180358,"parserVersion":"staging"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1731885439584,"parserVersion":"staging","processingTimeMs":20}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1731885439565,"parserVersion":"staging","processingTimeMs":20}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417","timestamp":1731885439039,"parserVersion":"staging","processingTimeMs":124}
{"id":"c3e783c9-54bc-42ee-970c-d871117399b2","timestamp":1731885439489,"parserVersion":"staging","processingTimeMs":288}
{"id":"cd7eb9db-196d-46a5-938d-68061a100cdb","timestamp":1731885439235,"parserVersion":"staging","processingTimeMs":196}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1731882693822,"parserVersion":"staging","error":"Reparsed 0dfbcad1-41be-4dc1-bcea-8407f6a2c907 Capabilities is null"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1731882693820,"parserVersion":"staging","error":"Something weird, inputs list >= rat List"}
{"id":"7dc8d574-7a05-4ee4-b370-059ddd38d144","timestamp":1731882693641,"parserVersion":"staging","error":"Extension count cannot be 0. This procedure is only invoked if there is at least one extension addition being encoded."}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1836d","timestamp":1731882693810,"parserVersion":"staging","error":"Reparsed bc8f5359-c997-47c2-836d-8a4df2d1836d Capabilities is null"}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417","timestamp":1731882693808,"parserVersion":"staging","error":"Reparsed bc8f5359-c997-47c2-836d-8a4df2d1c417 Capabilities is null"}
{"id":"bc8f5359-c997-47c2-9999-8a4df2d1836d","timestamp":1731882693650,"parserVersion":"staging","error":"Reparsed bc8f5359-c997-47c2-9999-8a4df2d1836d Capabilities is null"}
{"id":"db8f5359-c997-47c2-9999-8a4df2d1836d","timestamp":1731882693642,"parserVersion":"staging","error":"Reparsed db8f5359-c997-47c2-9999-8a4df2d1836d Capabilities is null"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1731885438148,"parserVersion":"staging","error":"Reparsed 0dfbcad1-41be-4dc1-bcea-8407f6a2c907 Capabilities is null","processingTimeMs":3}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1731885438145,"parserVersion":"staging","error":"Something weird, inputs list >= rat List","processingTimeMs":13}
{"id":"7dc8d574-7a05-4ee4-b370-059ddd38d144","timestamp":1731885438115,"parserVersion":"staging","error":"Extension count cannot be 0. This procedure is only invoked if there is at least one extension addition being encoded.","processingTimeMs":152}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1836d","timestamp":1731885438132,"parserVersion":"staging","error":"Reparsed bc8f5359-c997-47c2-836d-8a4df2d1836d Capabilities is null","processingTimeMs":2}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417","timestamp":1731885438130,"parserVersion":"staging","error":"Reparsed bc8f5359-c997-47c2-836d-8a4df2d1c417 Capabilities is null","processingTimeMs":11}
{"id":"bc8f5359-c997-47c2-9999-8a4df2d1836d","timestamp":1731885438119,"parserVersion":"staging","error":"Reparsed bc8f5359-c997-47c2-9999-8a4df2d1836d Capabilities is null","processingTimeMs":2}
{"id":"db8f5359-c997-47c2-9999-8a4df2d1836d","timestamp":1731885438117,"parserVersion":"staging","error":"Reparsed db8f5359-c997-47c2-9999-8a4df2d1836d Capabilities is null","processingTimeMs":2}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1730748181215,"parserVersion":"staging"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1730748181197,"parserVersion":"staging"}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417","timestamp":1730748180994,"parserVersion":"staging"}
{"id":"c3e783c9-54bc-42ee-970c-d871117399b2","timestamp":1730748181144,"parserVersion":"staging"}
{"id":"cd7eb9db-196d-46a5-938d-68061a100cdb","timestamp":1730748181076,"parserVersion":"staging"}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c907","timestamp":1731885440043,"parserVersion":"staging","processingTimeMs":20}
{"id":"0dfbcad1-41be-4dc1-bcea-8407f6a2c908","timestamp":1731885440022,"parserVersion":"staging","processingTimeMs":20}
{"id":"bc8f5359-c997-47c2-836d-8a4df2d1c417","timestamp":1731885439804,"parserVersion":"staging","processingTimeMs":27}
{"id":"c3e783c9-54bc-42ee-970c-d871117399b2","timestamp":1731885439982,"parserVersion":"staging","processingTimeMs":70}
{"id":"cd7eb9db-196d-46a5-938d-68061a100cdb","timestamp":1731885439917,"parserVersion":"staging","processingTimeMs":125}