how to add dynamic values to each post request of each user from feeder

Hi ,

I am trying to simulate the load for rest API Post request call to OPETSDB to add time series test data in millions as part of quick POC. I found Gatling might be right tool for this job since it is based on scala and Akka framework , can spawn requests very quickly and trying with this tool.

I have written example program where body () should be populated with dynamic values from feeder .

val scn = scenario(“Simulation for the opentsdb datapoints post service”).feed(myCustomFeeder).repeat(repeatCount) {

exec(
http(session => “Post a DataPoint”)
.post(customerLink)
.body( StringBody("""{
“metric”: “${metric}”,
“timestamp”: “${timestamp}”,
“value”: “${value}” ,
“tags”: {
“host”: “${host}”,
“if”: “${if}”
}
}"""))
.check(status is 200)
) }

I think I found some solution for this

I need to do exec().exec() chaining

in the first exec() I am able to set latest values to session and followed by next exec() method which does http post to rest call. This way I can have different values in each request.

Still exploring on this for better solution for further process to simulate 1000 threads with many repeats to simulate 10 million records across different time stamps one per millisecond.

Thanks
-Krishna Prasad

Hi Krishna Prasad,

I am also facing the same issue currently. I need to generate and pass a new Dynamic 20digit numeric ID to the Exec method each time. (If the repeat is 100 then 100 time i need to generate and pass it to the exec method to run) But only the 1st time random value is passing into the method :(:frowning: .

Can you please let me know how it can be resolved.

Many thanks in advance.

feed(feeder)
.exec(http(“Create WaitList”)
.put(“gateway/1.0/waitlist”)
.body(StringBody(
“”"{
“Customer”: {
“Name”: “John, Kennedy”,
“PrimaryNumber”: “8528528528”,
“AccountNumber”: “0952911090201”
},
“WorkOrder”: {
“Id”: “”""+ dataDev.getWorkOrderId() +s"""",
“JobUnits”: “16”,
“ManagementArea”: “4C”,
“BusinessUnit”: “821010000220”,
“JobTypeCd”: “TC”,
“JobNum”: “559168”,
“TimeSlot”: {
“TimeSlotCd”:“6”,
“StartTime”:“04:00:00”,
“EndTime”:“06:00:00”,
“AppointmentDate”:“2017-07-23”
}
},
“FirstAvailableTimeSlot”: {
“TimeSlotCd”:“6”,
“StartTime”:“06:00:00”,
“EndTime”:“08:00:00”,
“AppointmentDate”:“2017-07-24”
},
“PreferredTimeSlot”: [{
“TimeSlotCd”: “6”,
“StartTime”:“06:00:00”,
“EndTime”: “08:00:00”,
“AppointmentDate”: “2017-07-25”
}],
“OrderEntryPlatform”: “WFA”
}""")).asJSON
.check(status is 200)
.check(jsonPath("$.WLRequestId").saveAs(“wlreqId”))
.check(jsonPath("$.WLRequestStatus").saveAs(“wlstatus”))
)

Mahesh Nandam
9884494730.