Skip to content

Commit

Permalink
Merge pull request #189 from krylov/plugins-jmeter-213
Browse files Browse the repository at this point in the history
connect_time option was added
  • Loading branch information
direvius committed Dec 21, 2015
2 parents f0da0d5 + 57837e1 commit f4291ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ Options
* **args** - additional commandline arguments for JMeter
* **jmeter_path** - path to JMeter, allows to use alternative JMeter installation. Default: jmeter
* **buffered_seconds** - amount of seconds to which delay aggregator, to be sure that everything were read from jmeter's results file
* **connect_time** - it sets jmeter.save.saveservice.connect_time=false if the value is '0' or empty string, jmeter.save.saveservice.connect_time=true in any other cases, empty string by default
* **all other options in the section** - they will be passed as User Defined Variables to JMeter

Artifacts
Expand Down
16 changes: 14 additions & 2 deletions yandextank/plugins/JMeter/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def get_key():
return __file__

def get_available_options(self):
return ["jmx", "args", "jmeter_path", "buffer_size", "buffered_seconds", "use_argentum", "exclude_markers", ]
return ["jmx", "args", "jmeter_path", "buffer_size",
"buffered_seconds", "use_argentum", "exclude_markers",
"connect_time"]

def configure(self):
self.original_jmx = self.get_option("jmx")
Expand All @@ -60,10 +62,15 @@ def configure(self):
self.jmx = self.__add_jmeter_components(
self.original_jmx, self.jtl_file, self._get_variables())
self.core.add_artifact_file(self.jmx)
self.connect_time = self.get_option('connect_time', '') not in ['', '0']

def prepare_test(self):
self.args = [self.jmeter_path, "-n", "-t", self.jmx, '-j', self.jmeter_log,
'-Jjmeter.save.saveservice.default_delimiter=\\t']
connect_str = 'true'
if not self.connect_time:
connect_str = 'false'
self.args += ['-Jjmeter.save.saveservice.connect_time=%s' % connect_str]
self.args += tankcore.splitstring(self.user_args)

aggregator = None
Expand Down Expand Up @@ -311,13 +318,18 @@ def get_next_sample_from_sdw(self, force):
else:
self.data_queue.append(cur_time)
self.data_buffer[cur_time] = []

connect_value = 0
if self.jmeter.connect_time:
connect_value = int(data[9])

# marker, threads, overallRT, httpCode, netCode
data_item = [
data[2], int(data[7]), int(data[1]), self.exc_to_http(data[3]), netcode]
# bytes: sent received
data_item += [0, int(data[5])]
# connect send latency receive
data_item += [0, 0, int(data[8]), int(data[1]) - int(data[8])]
data_item += [connect_value, 0, int(data[8]), int(data[1]) - int(data[8])]
# accuracy
data_item += [0]
self.data_buffer[cur_time].append(data_item)
Expand Down

0 comments on commit f4291ca

Please sign in to comment.