[K/N] Fix deprecations and warnings in performance infra
This commit is contained in:
committed by
Space Team
parent
0947834f0d
commit
b01808ddf5
@@ -156,7 +156,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fromPreset(presets.js, 'js') {
|
fromPreset(presets.jsIr, 'js') {
|
||||||
compilations.main.kotlinOptions {
|
compilations.main.kotlinOptions {
|
||||||
main = "noCall"
|
main = "noCall"
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
js {
|
js(IR) {
|
||||||
browser {
|
browser {
|
||||||
distribution {
|
distribution {
|
||||||
directory = new File("$projectDir/web/")
|
directory = new File("$projectDir/web/")
|
||||||
|
|||||||
+2
-2
@@ -119,7 +119,7 @@ data class BuildInfo(val buildNumber: String, val startTime: String, val endTime
|
|||||||
val buildTypeElement = data.getOptionalField("buildType")
|
val buildTypeElement = data.getOptionalField("buildType")
|
||||||
val buildType = buildTypeElement?.let {
|
val buildType = buildTypeElement?.let {
|
||||||
elementToString(buildTypeElement, "buildType")
|
elementToString(buildTypeElement, "buildType")
|
||||||
} ?: null
|
}
|
||||||
return BuildInfo(buildNumber, startTime, endTime, CommitsList(commits), branch, agentInfo, buildType)
|
return BuildInfo(buildNumber, startTime, endTime, CommitsList(commits), branch, agentInfo, buildType)
|
||||||
} else {
|
} else {
|
||||||
error("Top level entity is expected to be an object. Please, check origin files.")
|
error("Top level entity is expected to be an object. Please, check origin files.")
|
||||||
@@ -161,7 +161,7 @@ abstract class ElasticSearchIndex(val indexName: String, val connector: ElasticS
|
|||||||
"mappings": {
|
"mappings": {
|
||||||
"properties": {
|
"properties": {
|
||||||
${mapping.map { (property, type) ->
|
${mapping.map { (property, type) ->
|
||||||
"\"${property}\": { \"type\": \"${type.name.toLowerCase()}\"${if (type == ElasticSearchType.DATE) "," +
|
"\"${property}\": { \"type\": \"${type.name.lowercase()}\"${if (type == ElasticSearchType.DATE) "," +
|
||||||
"\"format\": \"basic_date_time_no_millis\"" else ""} }"
|
"\"format\": \"basic_date_time_no_millis\"" else ""} }"
|
||||||
}.joinToString()}}
|
}.joinToString()}}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -27,7 +27,7 @@ class BenchmarksIndexesDispatcher(connector: ElasticSearchConnector, val feature
|
|||||||
// Becnhmarks indexes to work with in case of existing feature values.
|
// Becnhmarks indexes to work with in case of existing feature values.
|
||||||
private val benchmarksIndexes =
|
private val benchmarksIndexes =
|
||||||
if (featureValues.isNotEmpty())
|
if (featureValues.isNotEmpty())
|
||||||
featureValues.map { it to BenchmarksIndex("benchmarks_${it.replace(" ", "_").toLowerCase()}", connector) }
|
featureValues.map { it to BenchmarksIndex("benchmarks_${it.replace(" ", "_").lowercase()}", connector) }
|
||||||
.toMap()
|
.toMap()
|
||||||
else emptyMap()
|
else emptyMap()
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ class BenchmarksIndexesDispatcher(connector: ElasticSearchConnector, val feature
|
|||||||
"bool": {
|
"bool": {
|
||||||
"must": [
|
"must": [
|
||||||
{ "match": { "benchmarks.metric": "$metricName" } },
|
{ "match": { "benchmarks.metric": "$metricName" } },
|
||||||
{ "terms": { "benchmarks.name": [${samples.map { "\"${it.toLowerCase()}\"" }.joinToString()}] }}
|
{ "terms": { "benchmarks.name": [${samples.map { "\"${it.lowercase()}\"" }.joinToString()}] }}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}, "inner_hits": {
|
}, "inner_hits": {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ internal fun getBuildsDescription(type: String?, branch: String?, agentInfo: Str
|
|||||||
{ "regexp": { "buildNumber": { "value": "${if (it == "release")
|
{ "regexp": { "buildNumber": { "value": "${if (it == "release")
|
||||||
".*eap.*|.*release.*|.*rc.*" else ".*dev.*"}" } }
|
".*eap.*|.*release.*|.*rc.*" else ".*dev.*"}" } }
|
||||||
},
|
},
|
||||||
{ "match": { "buildType": "${it.toUpperCase()}" } }
|
{ "match": { "buildType": "${it.uppercase()}" } }
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
{ "bool": {
|
{ "bool": {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ external fun require(module: String): dynamic
|
|||||||
external val process: dynamic
|
external val process: dynamic
|
||||||
external val __dirname: dynamic
|
external val __dirname: dynamic
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main() {
|
||||||
println("Server Starting!")
|
println("Server Starting!")
|
||||||
|
|
||||||
val express = require("express")
|
val express = require("express")
|
||||||
@@ -28,7 +28,7 @@ fun main(args: Array<String>) {
|
|||||||
app.set("view engine", "ejs")
|
app.set("view engine", "ejs")
|
||||||
app.use(express.static("ui"))
|
app.use(express.static("ui"))
|
||||||
|
|
||||||
val server = http.createServer(app)
|
http.createServer(app)
|
||||||
app.listen(port, {
|
app.listen(port, {
|
||||||
println("App listening on port " + port + "!")
|
println("App listening on port " + port + "!")
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ object CachableResponseDispatcher {
|
|||||||
action: (success: (result: Any) -> Unit, reject: () -> Unit) -> Unit) {
|
action: (success: (result: Any) -> Unit, reject: () -> Unit) -> Unit) {
|
||||||
cachedResponses[request.url]?.let {
|
cachedResponses[request.url]?.let {
|
||||||
// Update cache value if needed. Update only if last result was get later than 2 minutes.
|
// Update cache value if needed. Update only if last result was get later than 2 minutes.
|
||||||
if (it.time.elapsedNow().inMinutes > 2.0) {
|
if (it.time.elapsedNow().inWholeMinutes >= 2.0) {
|
||||||
println("Cache update for ${request.url}...")
|
println("Cache update for ${request.url}...")
|
||||||
action({ result: Any ->
|
action({ result: Any ->
|
||||||
cachedResponses[request.url] = CachedResponse(result, TimeSource.Monotonic.markNow())
|
cachedResponses[request.url] = CachedResponse(result, TimeSource.Monotonic.markNow())
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ internal fun convertToNewFormat(data: JsonObject): List<Any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert data results to expected format.
|
// Convert data results to expected format.
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
internal fun convert(json: String, buildNumber: String, target: String): List<BenchmarksReport> {
|
internal fun convert(json: String, buildNumber: String, target: String): List<BenchmarksReport> {
|
||||||
val data = JsonTreeParser.parse(json)
|
val data = JsonTreeParser.parse(json)
|
||||||
val reports = if (data is JsonArray) {
|
val reports = if (data is JsonArray) {
|
||||||
@@ -143,12 +144,12 @@ data class BuildRegister(val buildId: String, val teamCityUser: String, val team
|
|||||||
val data = JsonTreeParser.parse(response).jsonObject
|
val data = JsonTreeParser.parse(response).jsonObject
|
||||||
data.getArray("build").forEach {
|
data.getArray("build").forEach {
|
||||||
(it as JsonObject).getObject("revisions").getArray("revision").forEach {
|
(it as JsonObject).getObject("revisions").getArray("revision").forEach {
|
||||||
val currentBranch = (it as JsonObject).getPrimitive("vcsBranchName").content.removePrefix("refs/heads/")
|
it as JsonObject
|
||||||
val currentProject = (it as JsonObject).getObject("vcs-root-instance").getPrimitive("name").content
|
val currentBranch = it.getPrimitive("vcsBranchName").content.removePrefix("refs/heads/")
|
||||||
|
val currentProject = it.getObject("vcs-root-instance").getPrimitive("name").content
|
||||||
if (projects.anyMatches(currentProject)) {
|
if (projects.anyMatches(currentProject)) {
|
||||||
branch = currentBranch
|
branch = currentBranch
|
||||||
}
|
}
|
||||||
return@forEach
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
branch ?: error("No project from list $projects can be found in build $buildId")
|
branch ?: error("No project from list $projects can be found in build $buildId")
|
||||||
@@ -476,7 +477,7 @@ fun router(networkConnector: NetworkConnector) {
|
|||||||
distinctValues("branch", buildInfoIndex).then { results ->
|
distinctValues("branch", buildInfoIndex).then { results ->
|
||||||
success(results)
|
success(results)
|
||||||
}.catch { errorMessage ->
|
}.catch { errorMessage ->
|
||||||
error(errorMessage.message ?: "Failed getting branches list.")
|
println(errorMessage.message ?: "Failed getting branches list.")
|
||||||
reject()
|
reject()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ repositories {
|
|||||||
apply plugin: 'kotlin-multiplatform'
|
apply plugin: 'kotlin-multiplatform'
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
js(IR) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
distribution {
|
distribution {
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ fun customizeChart(chart: dynamic, chartContainer: String, jquerySelector: dynam
|
|||||||
var element = data.element
|
var element = data.element
|
||||||
if (data.type == "point") {
|
if (data.type == "point") {
|
||||||
val pointSize = 12
|
val pointSize = 12
|
||||||
val currentBuild = builds.get(data.index)
|
builds.get(data.index)?.let { currentBuild ->
|
||||||
currentBuild?.let { currentBuild ->
|
|
||||||
// Higlight builds with failures.
|
// Higlight builds with failures.
|
||||||
if (currentBuild.failuresNumber > 0) {
|
if (currentBuild.failuresNumber > 0) {
|
||||||
val svgParameters: dynamic = object {}
|
val svgParameters: dynamic = object {}
|
||||||
@@ -148,9 +147,10 @@ fun customizeChart(chart: dynamic, chartContainer: String, jquerySelector: dynam
|
|||||||
append("time: ${currentBuild.formattedStartTime}-${currentBuild.formattedFinishTime}<br>")
|
append("time: ${currentBuild.formattedStartTime}-${currentBuild.formattedFinishTime}<br>")
|
||||||
append("Commits:<br>")
|
append("Commits:<br>")
|
||||||
val commitsList = (JsonTreeParser.parse("{${currentBuild.commits}}") as JsonObject).getArray("commits").map {
|
val commitsList = (JsonTreeParser.parse("{${currentBuild.commits}}") as JsonObject).getArray("commits").map {
|
||||||
|
it as JsonObject
|
||||||
Commit(
|
Commit(
|
||||||
(it as JsonObject).getPrimitive("revision").content,
|
it.getPrimitive("revision").content,
|
||||||
(it as JsonObject).getPrimitive("developer").content
|
it.getPrimitive("developer").content
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val commits = if (commitsList.size > 3) commitsList.slice(0..2) else commitsList
|
val commits = if (commitsList.size > 3) commitsList.slice(0..2) else commitsList
|
||||||
@@ -171,11 +171,11 @@ fun customizeChart(chart: dynamic, chartContainer: String, jquerySelector: dynam
|
|||||||
})
|
})
|
||||||
chart.on("created", {
|
chart.on("created", {
|
||||||
val currentChart = jquerySelector
|
val currentChart = jquerySelector
|
||||||
val parameters: dynamic = object {}
|
val chartParameters: dynamic = object {}
|
||||||
parameters["selector"] = "[data-chart-tooltip=\"$chartContainer\"]"
|
chartParameters["selector"] = "[data-chart-tooltip=\"$chartContainer\"]"
|
||||||
parameters["container"] = "#$chartContainer"
|
chartParameters["container"] = "#$chartContainer"
|
||||||
parameters["html"] = true
|
chartParameters["html"] = true
|
||||||
currentChart.tooltip(parameters)
|
currentChart.tooltip(chartParameters)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ external fun encodeURIComponent(url: String): String
|
|||||||
fun getDatesComponents() = "${beforeDate?.let {"&before=${encodeURIComponent(it)}"} ?: ""}" +
|
fun getDatesComponents() = "${beforeDate?.let {"&before=${encodeURIComponent(it)}"} ?: ""}" +
|
||||||
"${afterDate?.let {"&after=${encodeURIComponent(it)}"} ?: ""}"
|
"${afterDate?.let {"&after=${encodeURIComponent(it)}"} ?: ""}"
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main() {
|
||||||
val serverUrl = window.location.origin // use "http://localhost:3000" for local debug.
|
val serverUrl = window.location.origin // use "http://localhost:3000" for local debug.
|
||||||
val zoomRatio = 2
|
val zoomRatio = 2
|
||||||
|
|
||||||
@@ -216,6 +216,7 @@ fun main(args: Array<String>) {
|
|||||||
// Add release branches to selector.
|
// Add release branches to selector.
|
||||||
branches.filter { it != "master" }.forEach {
|
branches.filter { it != "master" }.forEach {
|
||||||
if ("^v?(\\d|\\.)+(-M\\d)?(-fixes)?$".toRegex().matches(it)) {
|
if ("^v?(\\d|\\.)+(-M\\d)?(-fixes)?$".toRegex().matches(it)) {
|
||||||
|
@Suppress("UNUSED_VARIABLE") // it's used within js block
|
||||||
val option = Option(it, it)
|
val option = Option(it, it)
|
||||||
js("$('#inputGroupBranch')").append(js("$(option)"))
|
js("$('#inputGroupBranch')").append(js("$(option)"))
|
||||||
}
|
}
|
||||||
@@ -310,8 +311,7 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
val metricUrl = "$serverUrl/metricValue/${parameters["target"]}/"
|
val metricUrl = "$serverUrl/metricValue/${parameters["target"]}/"
|
||||||
|
|
||||||
val unstableBenchmarksPromise = sendGetRequest("$serverUrl/unstable").then { response ->
|
val unstableBenchmarksPromise = sendGetRequest("$serverUrl/unstable").then { unstableList ->
|
||||||
val unstableList = response as String
|
|
||||||
val data = JsonTreeParser.parse(unstableList)
|
val data = JsonTreeParser.parse(unstableList)
|
||||||
if (data !is JsonArray) {
|
if (data !is JsonArray) {
|
||||||
error("Response is expected to be an array.")
|
error("Response is expected to be an array.")
|
||||||
@@ -322,15 +322,13 @@ fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get builds description.
|
// Get builds description.
|
||||||
val buildsInfoPromise = sendGetRequest(descriptionUrl).then { response ->
|
val buildsInfoPromise = sendGetRequest(descriptionUrl).then { buildsInfo ->
|
||||||
val buildsInfo = response as String
|
|
||||||
val data = JsonTreeParser.parse(buildsInfo)
|
val data = JsonTreeParser.parse(buildsInfo)
|
||||||
if (data !is JsonArray) {
|
if (data !is JsonArray) {
|
||||||
error("Response is expected to be an array.")
|
error("Response is expected to be an array.")
|
||||||
}
|
}
|
||||||
data.jsonArray.map {
|
data.jsonArray.map {
|
||||||
val element = it as JsonElement
|
if (it.isNull) null else Build.create(it as JsonObject)
|
||||||
if (element.isNull) null else Build.create(element as JsonObject)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,12 +403,12 @@ fun main(args: Array<String>) {
|
|||||||
else ""
|
else ""
|
||||||
|
|
||||||
val requestedMetric = if (metric.startsWith("EXECUTION_TIME")) "EXECUTION_TIME" else metric
|
val requestedMetric = if (metric.startsWith("EXECUTION_TIME")) "EXECUTION_TIME" else metric
|
||||||
val url = "$metricUrl$requestedMetric$getParameters$branchParameter${
|
val queryUrl = "$metricUrl$requestedMetric$getParameters$branchParameter${
|
||||||
if (parameters["type"] != "all")
|
if (parameters["type"] != "all")
|
||||||
(if (getParameters.isEmpty() && branchParameter.isEmpty()) "?" else "&") + "type=${parameters["type"]}"
|
(if (getParameters.isEmpty() && branchParameter.isEmpty()) "?" else "&") + "type=${parameters["type"]}"
|
||||||
else ""
|
else ""
|
||||||
}&count=$buildsNumberToShow${getDatesComponents()}"
|
}&count=$buildsNumberToShow${getDatesComponents()}"
|
||||||
sendGetRequest(url)
|
sendGetRequest(queryUrl)
|
||||||
}.toTypedArray()
|
}.toTypedArray()
|
||||||
|
|
||||||
// Get metrics values for charts.
|
// Get metrics values for charts.
|
||||||
@@ -422,8 +420,7 @@ fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val labels = results.map { it.first }
|
val labels = results.map { it.first }
|
||||||
val values = results[0]?.second?.size?.let { (0..it - 1).map { i -> results.map { it.second[i] } } }
|
val values = results[0].second.size.let { (0..it - 1).map { i -> results.map { it.second[i] } } }
|
||||||
?: emptyList()
|
|
||||||
labels to values
|
labels to values
|
||||||
}
|
}
|
||||||
val labels = valuesList[0].first
|
val labels = valuesList[0].first
|
||||||
@@ -436,7 +433,7 @@ fun main(args: Array<String>) {
|
|||||||
compileData = labels to values.map { it.map { it?.let { it / 1000 } } }
|
compileData = labels to values.map { it.map { it?.let { it / 1000 } } }
|
||||||
compileChart = Chartist.Line("#compile_chart",
|
compileChart = Chartist.Line("#compile_chart",
|
||||||
getChartData(labels, compileData.second),
|
getChartData(labels, compileData.second),
|
||||||
getChartOptions(valuesToShow["COMPILE_TIME"]!![0]!!["samples"]!!.split(',').toTypedArray(),
|
getChartOptions(valuesToShow["COMPILE_TIME"]!![0]["samples"]!!.split(',').toTypedArray(),
|
||||||
"Time, milliseconds"))
|
"Time, milliseconds"))
|
||||||
buildsInfoPromise.then { builds ->
|
buildsInfoPromise.then { builds ->
|
||||||
customizeChart(compileChart, "compile_chart", js("$(\"#compile_chart\")"), builds, parameters)
|
customizeChart(compileChart, "compile_chart", js("$(\"#compile_chart\")"), builds, parameters)
|
||||||
|
|||||||
Reference in New Issue
Block a user