Skip to content

Commit

Permalink
feat: update gatling 3.11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jigarkhwar committed Jun 25, 2024
1 parent 132be41 commit 4d96061
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sbt.*
object Dependencies {
private object Versions {
val kafka = "7.6.0-ce"
val gatling = "3.10.5"
val gatling = "3.11.4"
val avro4s = "4.1.2"
val avro = "1.11.3"
}
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# suppress inspection "UnusedProperty"
sbt.version=1.9.9
sbt.version=1.10.0
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ class KafkaAvro4sRequestAction[K, V](
attr requestName session flatMap { requestName =>
val outcome = sendRequest(requestName, producer, attr, throttled, session)

outcome.onFailure(errorMessage =>
statsEngine.reportUnbuildableRequest(session.scenario, session.groups, requestName, errorMessage),
)
outcome.onFailure(errorMessage => {
logger.error(errorMessage)
statsEngine.logRequestCrash(session.scenario, session.groups, requestName, s"Failed to build request: $errorMessage")
})

outcome
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ class KafkaRequestAction[K, V](
val outcome =
sendRequest(requestName, producer, attr, throttled, session)

outcome.onFailure(errorMessage =>
statsEngine.reportUnbuildableRequest(session.scenario, session.groups, requestName, errorMessage),
)
outcome.onFailure(errorMessage => {
logger.error(errorMessage)
statsEngine.logRequestCrash(session.scenario, session.groups, requestName, s"Failed to build request: $errorMessage")
})

outcome

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object KafkaMessagePreparer {
messageCharset(configuration, msg)
.flatMap(bodyCharset =>
if (msg.value.length > CharsParsingThreshold)
jsonParsers.safeParse(new ByteArrayInputStream(msg.value), bodyCharset)
jsonParsers.safeParse(new ByteArrayInputStream(msg.value))
else
jsonParsers.safeParse(new String(msg.value, bodyCharset)),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.galaxio.gatling.kafka.examples

import io.gatling.app.Gatling
import io.gatling.core.config.GatlingPropertiesBuilder
import io.gatling.shared.cli.GatlingCliOptions

object GatlingRunner {

Expand All @@ -10,10 +10,17 @@ object GatlingRunner {
// this is where you specify the class you want to run
val simulationClass = classOf[BasicSimulation].getName

val props = new GatlingPropertiesBuilder
props.simulationClass(simulationClass)

Gatling.fromMap(props.build)
Gatling.main(
args ++
Array(
GatlingCliOptions.Simulation.shortOption,
simulationClass,
GatlingCliOptions.ResultsFolder.shortOption,
"results",
GatlingCliOptions.Launcher.shortOption,
"sbt",
),
)
}

}

0 comments on commit 4d96061

Please sign in to comment.