diff --git a/pom.xml b/pom.xml
index dc14a86..6ed4b97 100644
--- a/pom.xml
+++ b/pom.xml
@@ -154,12 +154,6 @@
${kotlin.version}
test
-
- org.jetbrains.kotlinx
- kotlinx-coroutines-android
- 1.7.2
- runtime
-
io.prometheus
simpleclient_pushgateway
diff --git a/src/main/kotlin/jp/co/soramitsu/load/TransferAssets.kt b/src/main/kotlin/jp/co/soramitsu/load/TransferAssets.kt
index 038a246..1d6a447 100644
--- a/src/main/kotlin/jp/co/soramitsu/load/TransferAssets.kt
+++ b/src/main/kotlin/jp/co/soramitsu/load/TransferAssets.kt
@@ -4,8 +4,6 @@ import io.gatling.javaapi.core.CoreDsl.*
import io.gatling.javaapi.core.ScenarioBuilder
import jp.co.soramitsu.iroha2.asAccountId
import jp.co.soramitsu.iroha2.asAssetId
-import jp.co.soramitsu.iroha2.client.blockstream.BlockStreamStorage
-import jp.co.soramitsu.iroha2.client.blockstream.BlockStreamSubscription
import jp.co.soramitsu.iroha2.generated.*
import jp.co.soramitsu.iroha2.asDomainId
import jp.co.soramitsu.load.TechicalScns.Iroha2SetUp
@@ -46,17 +44,15 @@ class TransferAssets : Wrench13() {
Session
}
.exec { Session ->
- val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
- timer = CustomMetrics.subscriptionToBlockStreamTimer.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- Iroha2SetUp::class.simpleName
- ).startTimer()
- try {
- val idToSubscription: Pair, BlockStreamSubscription> =
- iroha2Client.subscribeToBlockStream(1, 2)
- subscription = idToSubscription.component2()
- } finally {
+ runBlocking {
+ val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
+ timer = CustomMetrics.subscriptionToBlockStreamTimer.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ Iroha2SetUp::class.simpleName
+ ).startTimer()
+ val idToSubscription = iroha2Client.subscribeToBlockStream(1, 2)
+ val subscription = idToSubscription.second
timer.observeDuration()
CustomMetrics.subscriptionToBlockStreamCount.labels(
"gatling",
@@ -65,20 +61,18 @@ class TransferAssets : Wrench13() {
).inc()
sendMetricsToPrometheus(CustomMetrics.subscriptionToBlockStreamCount, "transaction")
sendMetricsToPrometheus(CustomMetrics.subscriptionToBlockStreamTimer, "transaction")
- }
- timer = CustomMetrics.transferAssetTimer.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- Iroha2SetUp::class.simpleName
- ).startTimer()
- CustomMetrics.transferAssetCount.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- Iroha2SetUp::class.simpleName
- ).inc()
- sendMetricsToPrometheus(CustomMetrics.transferAssetCount, "transaction")
- try {
- runBlocking {
+ timer = CustomMetrics.transferAssetTimer.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ Iroha2SetUp::class.simpleName
+ ).startTimer()
+ CustomMetrics.transferAssetCount.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ Iroha2SetUp::class.simpleName
+ ).inc()
+ sendMetricsToPrometheus(CustomMetrics.transferAssetCount, "transaction")
+ try {
iroha2Client.sendTransaction {
account(anotherDevAccountIdSender)
transferAsset(anotherDevAssetIdSender, 1, targetDevAccountIdReceiver)
@@ -89,20 +83,20 @@ class TransferAssets : Wrench13() {
pliers.healthCheck(true, "TransferAssets")
}
}
- subscription.close()
+ subscription.stop()
+ } catch (ex: RuntimeException) {
+ CustomMetrics.transferAssetErrorCount.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ Iroha2SetUp::class.simpleName
+ ).inc()
+ sendMetricsToPrometheus(CustomMetrics.transferAssetErrorCount, "transaction")
+ println("Something went wrong on TransferAssets scenario, problem with transfer asset transaction: " + ex.message)
+ pliers.healthCheck(false, "TransferAssets")
+ } finally {
+ timer.observeDuration()
+ sendMetricsToPrometheus(CustomMetrics.transferAssetTimer, "transaction")
}
- } catch (ex: RuntimeException) {
- CustomMetrics.transferAssetErrorCount.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- Iroha2SetUp::class.simpleName
- ).inc()
- sendMetricsToPrometheus(CustomMetrics.transferAssetErrorCount, "transaction")
- println("Something went wrong on TransferAssets scenario, problem with transfer asset transaction: " + ex.message)
- pliers.healthCheck(false, "TransferAssets")
- } finally {
- timer.observeDuration()
- sendMetricsToPrometheus(CustomMetrics.transferAssetTimer, "transaction")
}
Session
}
diff --git a/src/main/kotlin/jp/co/soramitsu/load/TransferAssetsQuery.kt b/src/main/kotlin/jp/co/soramitsu/load/TransferAssetsQuery.kt
index 5a1cc21..876c811 100644
--- a/src/main/kotlin/jp/co/soramitsu/load/TransferAssetsQuery.kt
+++ b/src/main/kotlin/jp/co/soramitsu/load/TransferAssetsQuery.kt
@@ -49,46 +49,46 @@ class TransferAssetsQuery : Wrench13() {
Session
}
.exec { Session ->
- val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
- timer = CustomMetrics.findAssetsByAccountIdQueryTimer.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- TransferAssetsQuery::class.simpleName
- ).startTimer()
- CustomMetrics.findAssetsByAccountIdQueryCount.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- TransferAssetsQuery::class.simpleName
- ).inc()
- sendMetricsToPrometheus(CustomMetrics.findAssetsByAccountIdQueryCount, "query")
- try {
- runBlocking {
- QueryBuilder.findAssetsByAccountId(anotherDevAccountIdSender)
- .account(anotherDevAccountIdSender)
- .buildSigned(anotherDevKeyPair)
- .let { query ->
- iroha2Client.sendQuery(query)
- }
- }
- } catch (ex: RuntimeException) {
- CustomMetrics.findAssetsByAccountIdQueryErrorCount.labels(
+ val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
+ timer = CustomMetrics.findAssetsByAccountIdQueryTimer.labels(
"gatling",
System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
TransferAssetsQuery::class.simpleName
- ).inc()
- sendMetricsToPrometheus(CustomMetrics.findAssetsByAccountIdQueryErrorCount, "query")
- println("Something went wrong on findAssetsByAccountIdQuery request, problem with find asset query: " + ex.message)
- pliers.healthCheck(false, "TransferAssets")
- } finally {
- timer.observeDuration()
+ ).startTimer()
CustomMetrics.findAssetsByAccountIdQueryCount.labels(
"gatling",
System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
TransferAssetsQuery::class.simpleName
).inc()
sendMetricsToPrometheus(CustomMetrics.findAssetsByAccountIdQueryCount, "query")
- sendMetricsToPrometheus(CustomMetrics.findAssetsByAccountIdQueryTimer, "query")
- }
+ try {
+ runBlocking {
+ QueryBuilder.findAssetsByAccountId(anotherDevAccountIdSender)
+ .account(anotherDevAccountIdSender)
+ .buildSigned(anotherDevKeyPair)
+ .let { query ->
+ iroha2Client.sendQuery(query)
+ }
+ }
+ } catch (ex: RuntimeException) {
+ CustomMetrics.findAssetsByAccountIdQueryErrorCount.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ TransferAssetsQuery::class.simpleName
+ ).inc()
+ sendMetricsToPrometheus(CustomMetrics.findAssetsByAccountIdQueryErrorCount, "query")
+ println("Something went wrong on findAssetsByAccountIdQuery request, problem with find asset query: " + ex.message)
+ pliers.healthCheck(false, "TransferAssets")
+ } finally {
+ timer.observeDuration()
+ CustomMetrics.findAssetsByAccountIdQueryCount.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ TransferAssetsQuery::class.simpleName
+ ).inc()
+ sendMetricsToPrometheus(CustomMetrics.findAssetsByAccountIdQueryCount, "query")
+ sendMetricsToPrometheus(CustomMetrics.findAssetsByAccountIdQueryTimer, "query")
+ }
Session
}
.exec { Session ->
@@ -143,17 +143,15 @@ class TransferAssetsQuery : Wrench13() {
}.doIf { Session -> Session.getBoolean("condition") }
.then(
exec { Session ->
- val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
- timer = CustomMetrics.subscriptionToBlockStreamTimer.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- TransferAssetsQuery::class.simpleName
- ).startTimer()
- try {
- val idToSubscription: Pair, BlockStreamSubscription> =
- iroha2Client.subscribeToBlockStream(1, 2)
- subscription = idToSubscription.component2()
- } finally {
+ runBlocking {
+ val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
+ timer = CustomMetrics.subscriptionToBlockStreamTimer.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ TransferAssetsQuery::class.simpleName
+ ).startTimer()
+ val idToSubscription = iroha2Client.subscribeToBlockStream(1, 2)
+ val subscription = idToSubscription.second
timer.observeDuration()
CustomMetrics.subscriptionToBlockStreamCount.labels(
"gatling",
@@ -162,20 +160,18 @@ class TransferAssetsQuery : Wrench13() {
).inc()
sendMetricsToPrometheus(CustomMetrics.subscriptionToBlockStreamCount, "transaction")
sendMetricsToPrometheus(CustomMetrics.subscriptionToBlockStreamTimer, "transaction")
- }
- timer = CustomMetrics.transferAssetTimer.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- TransferAssetsQuery::class.simpleName
- ).startTimer()
- CustomMetrics.transferAssetCount.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- TransferAssetsQuery::class.simpleName
- ).inc()
- sendMetricsToPrometheus(CustomMetrics.transferAssetCount, "transaction")
- try {
- runBlocking {
+ timer = CustomMetrics.transferAssetTimer.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ TransferAssetsQuery::class.simpleName
+ ).startTimer()
+ CustomMetrics.transferAssetCount.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ TransferAssetsQuery::class.simpleName
+ ).inc()
+ sendMetricsToPrometheus(CustomMetrics.transferAssetCount, "transaction")
+ try {
iroha2Client.sendTransaction {
account(anotherDevAccountIdSender)
transferAsset(anotherDevAssetIdSender, 1, targetDevAccountIdReceiver)
@@ -186,23 +182,23 @@ class TransferAssetsQuery : Wrench13() {
pliers.healthCheck(true, "TransferAssets")
}
}
- subscription.close()
+ subscription.stop()
+ } catch (ex: RuntimeException) {
+ CustomMetrics.transferAssetErrorCount.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ TransferAssetsQuery::class.simpleName
+ ).inc()
+ sendMetricsToPrometheus(CustomMetrics.transferAssetErrorCount, "transaction")
+ println("Something went wrong on TransferAssets scenario, problem with transfer asset transaction: " + ex.message)
+ pliers.healthCheck(false, "TransferAssets")
+ } finally {
+ timer.observeDuration()
+ sendMetricsToPrometheus(CustomMetrics.transferAssetTimer, "transaction")
}
- } catch (ex: RuntimeException) {
- CustomMetrics.transferAssetErrorCount.labels(
- "gatling",
- System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
- TransferAssetsQuery::class.simpleName
- ).inc()
- sendMetricsToPrometheus(CustomMetrics.transferAssetErrorCount, "transaction")
- println("Something went wrong on TransferAssets scenario, problem with transfer asset transaction: " + ex.message)
- pliers.healthCheck(false, "TransferAssets")
- } finally {
- timer.observeDuration()
- sendMetricsToPrometheus(CustomMetrics.transferAssetTimer, "transaction")
+ val newSession = Session.set("condition", false)
+ newSession
}
- val newSession = Session.set("condition", false)
- newSession
}
.exec { Session ->
val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
diff --git a/src/main/kotlin/jp/co/soramitsu/load/triggers/WasmTrigger.kt b/src/main/kotlin/jp/co/soramitsu/load/triggers/WasmTrigger.kt
index 7448c2a..0beb0da 100644
--- a/src/main/kotlin/jp/co/soramitsu/load/triggers/WasmTrigger.kt
+++ b/src/main/kotlin/jp/co/soramitsu/load/triggers/WasmTrigger.kt
@@ -33,57 +33,71 @@ class WasmTrigger: Wrench13() {
val wasmTrigger = CoreDsl.scenario("WasmTrigger")
.feed(CoreDsl.csv("preconditionList.csv").circular())
.exec { Session ->
- val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
- anotherDev.anotherDevDomainId = Session.get("domainIdSender")!!.asDomainId()
- anotherDev.anotherDevAccountId = AccountId(
- anotherDev.anotherDevDomainId,
- Name("anotherDev${UUID.randomUUID()}_${UUID.randomUUID()}")
- )
- anotherDev.anotherDevKeyPair = generateKeyPair()
-
- val triggerKey = "mintAsset".asName()
- val triggerValue = "i_wont_a_cat".asValue()
- val metadata = Metadata(
- mapOf(
- Pair(triggerKey, triggerValue),
- ),
- )
- timer = CustomMetrics.accountRegisterTimer.labels(
- "gatling"
- , System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\")
- , WasmTrigger::class.simpleName).startTimer()
- try {
- runBlocking {
- iroha2Client.sendTransaction {
- account(aliceAccountId)
- registerAccount(
- anotherDev.anotherDevAccountId,
- listOf(anotherDev.anotherDevKeyPair.public.toIrohaPublicKey()),
- metadata = metadata
- )
- buildSigned(adminKeyPair)
- }.also { d ->
- withTimeout(Duration.ofSeconds(transactionWaiter)) {
- d.await()
- CustomMetrics.accountRegisterCount.labels(
- "gatling"
- , System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\")
- , WasmTrigger::class.simpleName).inc()
- sendMetricsToPrometheus(CustomMetrics.accountRegisterCount, "transaction")
- }
- }
- subscription.close()
- }
- } catch (ex: RuntimeException) {
- CustomMetrics.accountRegisterErrorCount.labels(
+ runBlocking{
+ val iroha2Client = buildClient(SimulationConfig.simulation.configuration())
+ anotherDev.anotherDevDomainId = Session.get("domainIdSender")!!.asDomainId()
+ anotherDev.anotherDevAccountId = AccountId(
+ anotherDev.anotherDevDomainId,
+ Name("anotherDev${UUID.randomUUID()}_${UUID.randomUUID()}")
+ )
+ anotherDev.anotherDevKeyPair = generateKeyPair()
+ val triggerKey = "mintAsset".asName()
+ val triggerValue = "i_wont_a_cat".asValue()
+ val metadata = Metadata(
+ mapOf(
+ Pair(triggerKey, triggerValue),
+ ),
+ )
+ timer = CustomMetrics.subscriptionToBlockStreamTimer.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ Iroha2SetUp::class.simpleName
+ ).startTimer()
+ val idToSubscription = iroha2Client.subscribeToBlockStream(1, 2)
+ val subscription = idToSubscription.second
+ timer.observeDuration()
+ CustomMetrics.subscriptionToBlockStreamCount.labels(
+ "gatling",
+ System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\"),
+ Iroha2SetUp::class.simpleName
+ ).inc()
+ sendMetricsToPrometheus(CustomMetrics.subscriptionToBlockStreamCount, "transaction")
+ sendMetricsToPrometheus(CustomMetrics.subscriptionToBlockStreamTimer, "transaction")
+ timer = CustomMetrics.accountRegisterTimer.labels(
"gatling"
, System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\")
- , WasmTrigger::class.simpleName).inc()
- sendMetricsToPrometheus(CustomMetrics.accountRegisterErrorCount, "transaction")
- println(ex.message)
- } finally {
- timer.observeDuration()
- sendMetricsToPrometheus(CustomMetrics.accountRegisterTimer, "transaction")
+ , WasmTrigger::class.simpleName).startTimer()
+ try {
+ iroha2Client.sendTransaction {
+ account(aliceAccountId)
+ registerAccount(
+ anotherDev.anotherDevAccountId,
+ listOf(anotherDev.anotherDevKeyPair.public.toIrohaPublicKey()),
+ metadata = metadata
+ )
+ buildSigned(adminKeyPair)
+ }.also { d ->
+ withTimeout(Duration.ofSeconds(transactionWaiter)) {
+ d.await()
+ CustomMetrics.accountRegisterCount.labels(
+ "gatling"
+ , System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\")
+ , WasmTrigger::class.simpleName).inc()
+ sendMetricsToPrometheus(CustomMetrics.accountRegisterCount, "transaction")
+ }
+ }
+ subscription.stop()
+ } catch (ex: RuntimeException) {
+ CustomMetrics.accountRegisterErrorCount.labels(
+ "gatling"
+ , System.getProperty("user.dir").substringAfterLast("/").substringAfterLast("\\")
+ , WasmTrigger::class.simpleName).inc()
+ sendMetricsToPrometheus(CustomMetrics.accountRegisterErrorCount, "transaction")
+ println(ex.message)
+ } finally {
+ timer.observeDuration()
+ sendMetricsToPrometheus(CustomMetrics.accountRegisterTimer, "transaction")
+ }
}
Session
}
diff --git a/src/test/java/jp/co/soramitsu/load/Engine.java b/src/test/java/jp/co/soramitsu/load/Engine.java
index d3b883d..d5ff2f2 100644
--- a/src/test/java/jp/co/soramitsu/load/Engine.java
+++ b/src/test/java/jp/co/soramitsu/load/Engine.java
@@ -10,7 +10,7 @@ public static void main(String[] args) {
.resourcesDirectory(IDEPathHelper.mavenResourcesDirectory.toString())
.resultsDirectory(IDEPathHelper.resultsDirectory.toString())
.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString())
- .simulationClass(SimulationConfig.simulation.loadSimulationTrigger());
+ .simulationClass(SimulationConfig.simulation.loadSimulation());
Gatling.fromMap(props.build());
}
}
diff --git a/src/test/resources/simulation.properties b/src/test/resources/simulation.properties
index 756f7ee..ba4ec98 100644
--- a/src/test/resources/simulation.properties
+++ b/src/test/resources/simulation.properties
@@ -1,12 +1,12 @@
#Simulation parameters. Durations in sec
debugSimulation=jp.co.soramitsu.load.simulation.DebugSimulation
-loadSimulation=jp.co.soramitsu.load.simulation.transaction.StabilitySimulation
maximumSearchSimulation=jp.co.soramitsu.load.simulation.transaction.PerformanceSimulation
+loadSimulation=jp.co.soramitsu.load.simulation.transaction.StabilitySimulation
stressSimulation=jp.co.soramitsu.load.simulation.transaction.StressSimulation
maximumSearchSimulationTrigger=jp.co.soramitsu.load.simulation.smartcontract.PerformanceSimulation
-stressSimulationTrigger=jp.co.soramitsu.load.simulation.smartcontract.StressSimulation
loadSimulationTrigger=jp.co.soramitsu.load.simulation.smartcontract.StabilitySimulation
+stressSimulationTrigger=jp.co.soramitsu.load.simulation.smartcontract.StressSimulation
scenario=Iroha2SetUp