[K/N] Get rid of urls in perf infra code
This commit is contained in:
@@ -313,7 +313,11 @@ subprojects.each {
|
|||||||
|
|
||||||
task teamCityStat(type:Exec) {
|
task teamCityStat(type:Exec) {
|
||||||
def analyzer = findAnalyzerBinary()
|
def analyzer = findAnalyzerBinary()
|
||||||
commandLine analyzer, "-r", "teamcity", "${buildDir.absolutePath}/${nativeJson}"
|
commandLine analyzer, "-r", "teamcity",
|
||||||
|
"--artifactory-url", "https://repo.labs.intellij.net/kotlin-native-benchmarks",
|
||||||
|
"--teamcity-url", "http://buildserver.labs.intellij.net",
|
||||||
|
"--server-url", findProperty("kotlin.native.performance.server.url")?.toString() ?: "http://localhost:3000",
|
||||||
|
"${buildDir.absolutePath}/${nativeJson}"
|
||||||
}
|
}
|
||||||
|
|
||||||
task cinterop {
|
task cinterop {
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ expect fun Double.format(decimalNumber: Int = 4): String
|
|||||||
expect fun writeToFile(fileName: String, text: String)
|
expect fun writeToFile(fileName: String, text: String)
|
||||||
expect fun assert(value: Boolean, lazyMessage: () -> Any)
|
expect fun assert(value: Boolean, lazyMessage: () -> Any)
|
||||||
expect fun sendGetRequest(url: String, user: String? = null, password: String? = null,
|
expect fun sendGetRequest(url: String, user: String? = null, password: String? = null,
|
||||||
followLocation: Boolean = false) : String
|
followLocation: Boolean = false) : String
|
||||||
|
expect fun getDefaultPerformanceServerUrl(): String?
|
||||||
+3
-1
@@ -36,4 +36,6 @@ actual fun sendGetRequest(url: String, user: String?, password: String?, followL
|
|||||||
return request.responseText
|
return request.responseText
|
||||||
}
|
}
|
||||||
error("Request to $url has status ${request.status}")
|
error("Request to $url has status ${request.status}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actual fun getDefaultPerformanceServerUrl() : String? = window.location.origin
|
||||||
+3
-1
@@ -61,4 +61,6 @@ actual fun sendGetRequest(url: String, user: String?, password: String?, followL
|
|||||||
redirect.setRequestProperty("Cookie", cookies)
|
redirect.setRequestProperty("Cookie", cookies)
|
||||||
redirect.connect()
|
redirect.connect()
|
||||||
return redirect.inputStream.use { it.reader().use { reader -> reader.readText() } }
|
return redirect.inputStream.use { it.reader().use { reader -> reader.readText() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actual fun getDefaultPerformanceServerUrl() : String? = null
|
||||||
+2
@@ -106,3 +106,5 @@ actual fun sendGetRequest(url: String, user: String?, password: String?, followL
|
|||||||
curl.close()
|
curl.close()
|
||||||
return curl.body.toString()
|
return curl.body.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actual fun getDefaultPerformanceServerUrl() : String? = null
|
||||||
@@ -4,9 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import kotlinx.cli.*
|
import kotlinx.cli.*
|
||||||
import org.jetbrains.analyzer.sendGetRequest
|
import org.jetbrains.analyzer.*
|
||||||
import org.jetbrains.analyzer.readFile
|
|
||||||
import org.jetbrains.analyzer.SummaryBenchmarksReport
|
|
||||||
import org.jetbrains.renders.*
|
import org.jetbrains.renders.*
|
||||||
import org.jetbrains.report.*
|
import org.jetbrains.report.*
|
||||||
import org.jetbrains.report.json.*
|
import org.jetbrains.report.json.*
|
||||||
@@ -22,9 +20,12 @@ abstract class Connector {
|
|||||||
|
|
||||||
object ArtifactoryConnector : Connector() {
|
object ArtifactoryConnector : Connector() {
|
||||||
override val connectorPrefix = "artifactory:"
|
override val connectorPrefix = "artifactory:"
|
||||||
val artifactoryUrl = "https://repo.labs.intellij.net/kotlin-native-benchmarks"
|
lateinit var artifactoryUrl : String
|
||||||
|
|
||||||
override fun getFileContent(fileLocation: String, user: String?): String {
|
override fun getFileContent(fileLocation: String, user: String?): String {
|
||||||
|
if (!this::artifactoryUrl.isInitialized) {
|
||||||
|
throw IllegalStateException("--arifactory-url option is required to use artifactory-hosted results")
|
||||||
|
}
|
||||||
val fileParametersSize = 3
|
val fileParametersSize = 3
|
||||||
val fileDescription = fileLocation.substringAfter(connectorPrefix)
|
val fileDescription = fileLocation.substringAfter(connectorPrefix)
|
||||||
val fileParameters = fileDescription.split(':', limit = fileParametersSize)
|
val fileParameters = fileDescription.split(':', limit = fileParametersSize)
|
||||||
@@ -47,9 +48,12 @@ object ArtifactoryConnector : Connector() {
|
|||||||
|
|
||||||
object TeamCityConnector : Connector() {
|
object TeamCityConnector : Connector() {
|
||||||
override val connectorPrefix = "teamcity:"
|
override val connectorPrefix = "teamcity:"
|
||||||
val teamCityUrl = "http://buildserver.labs.intellij.net"
|
lateinit var teamCityUrl : String
|
||||||
|
|
||||||
override fun getFileContent(fileLocation: String, user: String?): String {
|
override fun getFileContent(fileLocation: String, user: String?): String {
|
||||||
|
if (!this::teamCityUrl.isInitialized) {
|
||||||
|
throw IllegalStateException("--teamcity-url option is required to use artifactory-hosted results")
|
||||||
|
}
|
||||||
val fileDescription = fileLocation.substringAfter(connectorPrefix)
|
val fileDescription = fileLocation.substringAfter(connectorPrefix)
|
||||||
val buildLocator = fileDescription.substringBeforeLast(':')
|
val buildLocator = fileDescription.substringBeforeLast(':')
|
||||||
val fileName = fileDescription.substringAfterLast(':')
|
val fileName = fileDescription.substringAfterLast(':')
|
||||||
@@ -67,9 +71,12 @@ object TeamCityConnector : Connector() {
|
|||||||
|
|
||||||
object DBServerConnector : Connector() {
|
object DBServerConnector : Connector() {
|
||||||
override val connectorPrefix = ""
|
override val connectorPrefix = ""
|
||||||
val serverUrl = "https://kotlin-native-perf-summary.labs.jb.gg"
|
lateinit var serverUrl: String
|
||||||
|
|
||||||
override fun getFileContent(fileLocation: String, user: String?): String {
|
override fun getFileContent(fileLocation: String, user: String?): String {
|
||||||
|
if (!this::serverUrl.isInitialized) {
|
||||||
|
throw IllegalStateException("--server-url option is required")
|
||||||
|
}
|
||||||
val buildNumber = fileLocation.substringBefore(':')
|
val buildNumber = fileLocation.substringBefore(':')
|
||||||
val target = fileLocation.substringAfter(':')
|
val target = fileLocation.substringAfter(':')
|
||||||
if (target == buildNumber) {
|
if (target == buildNumber) {
|
||||||
@@ -171,12 +178,27 @@ fun main(args: Array<String>) {
|
|||||||
val flatReport by argParser.option(ArgType.Boolean, "flat", "f", "Generate fflat report without splitting into stable and unstable becnhmarks")
|
val flatReport by argParser.option(ArgType.Boolean, "flat", "f", "Generate fflat report without splitting into stable and unstable becnhmarks")
|
||||||
.default(false)
|
.default(false)
|
||||||
|
|
||||||
|
val serverUrlArg by argParser.option(ArgType.String, "server-url", description = "Url of performance server")
|
||||||
|
val teamCityUrl by argParser.option(ArgType.String, "teamcity-url", description = "Url of teamcity server")
|
||||||
|
val artifactoryUrl by argParser.option(ArgType.String, "artifactory-url", description = "Url of artifactory server")
|
||||||
|
|
||||||
argParser.parse(args)
|
argParser.parse(args)
|
||||||
|
|
||||||
|
val serverUrl = serverUrlArg ?: getDefaultPerformanceServerUrl()
|
||||||
|
|
||||||
|
teamCityUrl?.let { TeamCityConnector.teamCityUrl = it }
|
||||||
|
artifactoryUrl?.let { ArtifactoryConnector.artifactoryUrl = it }
|
||||||
|
serverUrl?.let { DBServerConnector.serverUrl = it }
|
||||||
|
|
||||||
// Get unstable benchmarks.
|
// Get unstable benchmarks.
|
||||||
val unstableBenchmarks = if (!flatReport) DBServerConnector.getUnstableBenchmarks() else null
|
val unstableBenchmarks = if (!flatReport && serverUrl != null) {
|
||||||
|
DBServerConnector.getUnstableBenchmarks()
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
if (!flatReport && unstableBenchmarks == null)
|
if (!flatReport && unstableBenchmarks == null)
|
||||||
println("Failed to get access to server and get unstable benchmarks list!")
|
println("Failed to get access to server and get unstable benchmarks list, use -f option to assume it's empty.")
|
||||||
|
|
||||||
// Read contents of file.
|
// Read contents of file.
|
||||||
val mainBenchsReport = mergeReportsWithDetailedFlags(getBenchmarkReport(mainReport, user))
|
val mainBenchsReport = mergeReportsWithDetailedFlags(getBenchmarkReport(mainReport, user))
|
||||||
|
|||||||
+3
-1
@@ -26,4 +26,6 @@ actual fun assert(value: Boolean, lazyMessage: () -> Any) {
|
|||||||
|
|
||||||
actual fun sendGetRequest(url: String, user: String?, password: String?, followLocation: Boolean) : String {
|
actual fun sendGetRequest(url: String, user: String?, password: String?, followLocation: Boolean) : String {
|
||||||
error("Unsupported")
|
error("Unsupported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actual fun getDefaultPerformanceServerUrl() : String? = null
|
||||||
@@ -132,7 +132,7 @@ fun customizeChart(chart: dynamic, chartContainer: String, jquerySelector: dynam
|
|||||||
previousBuild = builds.get(data.index - shift)
|
previousBuild = builds.get(data.index - shift)
|
||||||
shift++
|
shift++
|
||||||
}
|
}
|
||||||
val linkToDetailedInfo = "https://kotlin-native-perf-summary.labs.jb.gg/compare?report=" +
|
val linkToDetailedInfo = "${window.location.origin}/compare?report=" +
|
||||||
"${currentBuild.buildNumber}:${parameters["target"]}" +
|
"${currentBuild.buildNumber}:${parameters["target"]}" +
|
||||||
"${previousBuild?.let {
|
"${previousBuild?.let {
|
||||||
"&compareTo=${previousBuild.buildNumber}:${parameters["target"]}"
|
"&compareTo=${previousBuild.buildNumber}:${parameters["target"]}"
|
||||||
@@ -190,7 +190,7 @@ fun getDatesComponents() = "${beforeDate?.let {"&before=${encodeURIComponent(it)
|
|||||||
"${afterDate?.let {"&after=${encodeURIComponent(it)}"} ?: ""}"
|
"${afterDate?.let {"&after=${encodeURIComponent(it)}"} ?: ""}"
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val serverUrl = "https://kotlin-native-perf-summary.labs.jb.gg" // 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
|
||||||
|
|
||||||
// Get parameters from request.
|
// Get parameters from request.
|
||||||
|
|||||||
Reference in New Issue
Block a user