Skip to content

Commit

Permalink
Merge pull request #532 from yandex/release
Browse files Browse the repository at this point in the history
Release-1.9.10
  • Loading branch information
fomars committed Mar 6, 2018
2 parents bd761d2 + 7324d02 commit e0a718d
Show file tree
Hide file tree
Showing 45 changed files with 453 additions and 654 deletions.
305 changes: 174 additions & 131 deletions docs/config_reference.rst

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

setup(
name='yandextank',
version='1.9.9',
version='1.9.10',

description='a performance measurement tool',
longer_description='''
Yandex.Tank is a performance measurement and load testing automatization tool.
Expand Down
20 changes: 13 additions & 7 deletions yandextank/aggregator/tank_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .aggregator import Aggregator, DataPoller
from .chopper import TimeChopper
from yandextank.common.interfaces import AggregateResultListener
from yandextank.common.interfaces import AggregateResultListener, StatsReader
from yandextank.common.util import Drain, Chopper

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -59,11 +59,14 @@ def __init__(self, generator):
self.drain = None
self.stats_drain = None

@staticmethod
def load_config():
return json.loads(resource_string(__name__, 'config/phout.json').decode('utf8'))

def start_test(self):
self.reader = self.generator.get_reader()
self.stats_reader = self.generator.get_stats_reader()
aggregator_config = json.loads(
resource_string(__name__, 'config/phout.json').decode('utf8'))
aggregator_config = self.load_config()
verbose_histogram = True
if verbose_histogram:
logger.info("using verbose histogram")
Expand All @@ -84,14 +87,14 @@ def start_test(self):
else:
logger.warning("Generator not found. Generator must provide a reader and a stats_reader interface")

def _collect_data(self):
def _collect_data(self, end=False):
"""
Collect data, cache it and send to listeners
"""
data = get_from_queue(self.results)
stats = get_from_queue(self.stats)
logger.debug("Data timestamps:\n%s" % [d.get('ts') for d in data])
logger.debug("Stats timestamps:\n%s" % [d.get('ts') for d in stats])
logger.debug("Data timestamps: %s" % [d.get('ts') for d in data])
logger.debug("Stats timestamps: %s" % [d.get('ts') for d in stats])
for item in data:
ts = item['ts']
if ts in self.stat_cache:
Expand All @@ -110,6 +113,9 @@ def _collect_data(self):
self.__notify_listeners(data_item, stat_item)
else:
self.stat_cache[ts] = item
if end and len(self.data_cache) > 0:
for ts, data_item in sorted(self.data_cache.items(), key=lambda i: i[0]):
self.__notify_listeners(data_item, StatsReader.stats_item(ts, 0, 0))

def is_test_finished(self):
self._collect_data()
Expand All @@ -125,7 +131,7 @@ def end_test(self, retcode):
self.drain.join()
if self.stats_drain:
self.stats_drain.join()
self._collect_data()
self._collect_data(end=True)
return retcode

def add_result_listener(self, listener):
Expand Down
3 changes: 3 additions & 0 deletions yandextank/aggregator/tests/phout2927
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1502376593.698 "Technology 797 208 12 521 56 670 31 315 0 404
1502376594.699 "/v1/tech/ru-RU/latest/maps/jsapi", 750 206 11 452 81 602 24 315 0 404
1502376597.698 #3 669 146 9 410 104 581 18 315 0 404
5 changes: 5 additions & 0 deletions yandextank/aggregator/tests/phout2927res.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{"tagged": {"\"Technology": {"size_in": {"max": 315, "total": 315, "len": 1, "min": 315}, "latency": {"max": 521, "total": 521, "len": 1, "min": 521}, "interval_real": {"q": {"q": [50, 75, 80, 85, 90, 95, 98, 99, 100], "value": [797.0, 797.0, 797.0, 797.0, 797.0, 797.0, 797.0, 797.0, 797.0]}, "min": 797, "max": 797, "len": 1, "hist": {"data": [1], "bins": [800.0]}, "total": 797}, "interval_event": {"max": 670, "total": 670, "len": 1, "min": 670}, "receive_time": {"max": 56, "total": 56, "len": 1, "min": 56}, "connect_time": {"max": 208, "total": 208, "len": 1, "min": 208}, "proto_code": {"count": {"404": 1}}, "size_out": {"max": 31, "total": 31, "len": 1, "min": 31}, "send_time": {"max": 12, "total": 12, "len": 1, "min": 12}, "net_code": {"count": {"0": 1}}}}, "overall": {"size_in": {"max": 315, "total": 315, "len": 1, "min": 315}, "latency": {"max": 521, "total": 521, "len": 1, "min": 521}, "interval_real": {"q": {"q": [50, 75, 80, 85, 90, 95, 98, 99, 100], "value": [797.0, 797.0, 797.0, 797.0, 797.0, 797.0, 797.0, 797.0, 797.0]}, "min": 797, "max": 797, "len": 1, "hist": {"data": [1], "bins": [800.0]}, "total": 797}, "interval_event": {"max": 670, "total": 670, "len": 1, "min": 670}, "receive_time": {"max": 56, "total": 56, "len": 1, "min": 56}, "connect_time": {"max": 208, "total": 208, "len": 1, "min": 208}, "proto_code": {"count": {"404": 1}}, "size_out": {"max": 31, "total": 31, "len": 1, "min": 31}, "send_time": {"max": 12, "total": 12, "len": 1, "min": 12}, "net_code": {"count": {"0": 1}}}, "ts": 1502376593},
{"tagged": {"\"/v1/tech/ru-RU/latest/maps/jsapi\",": {"size_in": {"max": 315, "total": 315, "len": 1, "min": 315}, "latency": {"max": 452, "total": 452, "len": 1, "min": 452}, "interval_real": {"q": {"q": [50, 75, 80, 85, 90, 95, 98, 99, 100], "value": [750.0, 750.0, 750.0, 750.0, 750.0, 750.0, 750.0, 750.0, 750.0]}, "min": 750, "max": 750, "len": 1, "hist": {"data": [1], "bins": [760.0]}, "total": 750}, "interval_event": {"max": 602, "total": 602, "len": 1, "min": 602}, "receive_time": {"max": 81, "total": 81, "len": 1, "min": 81}, "connect_time": {"max": 206, "total": 206, "len": 1, "min": 206}, "proto_code": {"count": {"404": 1}}, "size_out": {"max": 24, "total": 24, "len": 1, "min": 24}, "send_time": {"max": 11, "total": 11, "len": 1, "min": 11}, "net_code": {"count": {"0": 1}}}}, "overall": {"size_in": {"max": 315, "total": 315, "len": 1, "min": 315}, "latency": {"max": 452, "total": 452, "len": 1, "min": 452}, "interval_real": {"q": {"q": [50, 75, 80, 85, 90, 95, 98, 99, 100], "value": [750.0, 750.0, 750.0, 750.0, 750.0, 750.0, 750.0, 750.0, 750.0]}, "min": 750, "max": 750, "len": 1, "hist": {"data": [1], "bins": [760.0]}, "total": 750}, "interval_event": {"max": 602, "total": 602, "len": 1, "min": 602}, "receive_time": {"max": 81, "total": 81, "len": 1, "min": 81}, "connect_time": {"max": 206, "total": 206, "len": 1, "min": 206}, "proto_code": {"count": {"404": 1}}, "size_out": {"max": 24, "total": 24, "len": 1, "min": 24}, "send_time": {"max": 11, "total": 11, "len": 1, "min": 11}, "net_code": {"count": {"0": 1}}}, "ts": 1502376594},
{"tagged": {"": {"size_in": {"max": 315, "total": 315, "len": 1, "min": 315}, "latency": {"max": 410, "total": 410, "len": 1, "min": 410}, "interval_real": {"q": {"q": [50, 75, 80, 85, 90, 95, 98, 99, 100], "value": [669.0, 669.0, 669.0, 669.0, 669.0, 669.0, 669.0, 669.0, 669.0]}, "min": 669, "max": 669, "len": 1, "hist": {"data": [1], "bins": [670.0]}, "total": 669}, "interval_event": {"max": 581, "total": 581, "len": 1, "min": 581}, "receive_time": {"max": 104, "total": 104, "len": 1, "min": 104}, "connect_time": {"max": 146, "total": 146, "len": 1, "min": 146}, "proto_code": {"count": {"404": 1}}, "size_out": {"max": 18, "total": 18, "len": 1, "min": 18}, "send_time": {"max": 9, "total": 9, "len": 1, "min": 9}, "net_code": {"count": {"0": 1}}}}, "overall": {"size_in": {"max": 315, "total": 315, "len": 1, "min": 315}, "latency": {"max": 410, "total": 410, "len": 1, "min": 410}, "interval_real": {"q": {"q": [50, 75, 80, 85, 90, 95, 98, 99, 100], "value": [669.0, 669.0, 669.0, 669.0, 669.0, 669.0, 669.0, 669.0, 669.0]}, "min": 669, "max": 669, "len": 1, "hist": {"data": [1], "bins": [670.0]}, "total": 669}, "interval_event": {"max": 581, "total": 581, "len": 1, "min": 581}, "receive_time": {"max": 104, "total": 104, "len": 1, "min": 104}, "connect_time": {"max": 146, "total": 146, "len": 1, "min": 146}, "proto_code": {"count": {"404": 1}}, "size_out": {"max": 18, "total": 18, "len": 1, "min": 18}, "send_time": {"max": 9, "total": 9, "len": 1, "min": 9}, "net_code": {"count": {"0": 1}}}, "ts": 1502376597}
]
26 changes: 23 additions & 3 deletions yandextank/aggregator/tests/test_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import json

import numpy as np
from pkg_resources import resource_filename
import pytest
from queue import Queue

from yandextank.aggregator import TankAggregator
from yandextank.aggregator.aggregator import Aggregator, DataPoller
from yandextank.aggregator.chopper import TimeChopper

from conftest import MAX_TS, random_split
from yandextank.common.util import Drain

with open(resource_filename("yandextank.aggregator", 'config/phout.json')) as f:
AGGR_CONFIG = json.load(f)
from yandextank.plugins.Phantom.reader import string_to_df

AGGR_CONFIG = TankAggregator.load_config()


class TestPipeline(object):
Expand Down Expand Up @@ -49,3 +52,20 @@ def producer():
drain = Drain(pipeline, results_queue)
drain.run()
assert results_queue.qsize() == MAX_TS

@pytest.mark.parametrize('phout, results', [
('yandextank/aggregator/tests/phout2927', 'yandextank/aggregator/tests/phout2927res.jsonl')
])
def test_invalid_ammo(self, phout, results):
with open(phout) as fp:
reader = [string_to_df(line) for line in fp.readlines()]
pipeline = Aggregator(
TimeChopper(
DataPoller(source=reader, poll_period=0),
cache_size=3),
AGGR_CONFIG,
True)
with open(results) as fp:
results_parsed = json.load(fp)
for item, result in zip(pipeline, results_parsed):
assert item == result
12 changes: 12 additions & 0 deletions yandextank/common/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,15 @@ def get_stats_reader(self):

def end_test(self, retcode):
pass


class StatsReader(object):
@staticmethod
def stats_item(ts, instances, rps):
return {
'ts': ts,
'metrics': {
'instances': instances,
'reqps': rps
}
}
3 changes: 2 additions & 1 deletion yandextank/config_converter/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def parse_package_name(package_path):
'BatteryHistorian': 'battery_historian',
'Bfg': 'bfg|ultimate_gun|http_gun|custom_gun|scenario_gun',
'Phantom': 'phantom(-.*)?',
'DataUploader': 'meta|overload',
'DataUploader': 'meta|overload|uploader|datauploader',
'Telegraf': 'telegraf|monitoring',
'JMeter': 'jmeter',
'ResourceCheck': 'rcheck',
Expand Down Expand Up @@ -181,6 +181,7 @@ class Option(object):
'Bfg': {
'rps_schedule': convert_rps_schedule,
'instances_schedule': convert_instances_schedule,
'headers': lambda key, value: {key: re.compile('\[(.*?)\]').findall(value)}
},
'JMeter': {
'exclude_markers': lambda key, value: {key: value.strip().split(' ')}
Expand Down
3 changes: 2 additions & 1 deletion yandextank/config_converter/tests/test_config3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ uploader:
job_name: light
ignore_target_lock: true
regress: true
notify: fomars
notify:
- fomars
meta:
launched_from: centurion
#production log
Expand Down
6 changes: 4 additions & 2 deletions yandextank/config_converter/tests/test_config5.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ bfg:
schedule: const(10, 60s)
instances: 1
header_http: '1.1'
uris: /
uris: ['/']
loop: 1000
headers: "[Host: nodejs.load.yandex.net]\n[Connection: close]"
headers:
- 'Host: nodejs.load.yandex.net'
- 'Connection: close'
gun_type: ultimate
gun_config:
module_path: '.'
Expand Down
6 changes: 4 additions & 2 deletions yandextank/config_converter/tests/test_config5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ bfg:
schedule: const(10, 60s)
instances: 1
header_http: '1.1'
uris: /
uris: ['/']
loop: 1000
headers: "[Host: nodejs.load.yandex.net]\n[Connection: close]"
headers:
- 'Host: nodejs.load.yandex.net'
- 'Connection: close'
gun_type: ultimate
gun_config:
module_path: '.'
Expand Down
1 change: 0 additions & 1 deletion yandextank/core/config/00-base.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugin_aggregate=yandextank.plugins.Aggregator
plugin_autostop=yandextank.plugins.Autostop
plugin_telegraf=yandextank.plugins.Telegraf
plugin_console=yandextank.plugins.Console
plugin_tips=yandextank.plugins.TipsAndTricks
plugin_rcassert=yandextank.plugins.RCAssert
plugin_jsonreport=yandextank.plugins.JsonReport
artifacts_base_dir=logs
Expand Down
3 changes: 0 additions & 3 deletions yandextank/core/config/00-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ shellexec:
telegraf:
enabled: true
package: yandextank.plugins.Telegraf
tips:
enabled: true
package: yandextank.plugins.TipsAndTricks
rcassert:
enabled: true
package: yandextank.plugins.RCAssert
Expand Down
2 changes: 1 addition & 1 deletion yandextank/core/tankcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def wait_for_finish(self):
end_time = time.time()
diff = end_time - begin_time
logger.debug("Polling took %s", diff)
logger.debug("Tank status:\n%s", json.dumps(self.status, indent=2))
logger.debug("Tank status: %s", json.dumps(self.status))
# screen refresh every 0.5 s
if diff < 0.5:
time.sleep(0.5 - diff)
Expand Down
4 changes: 2 additions & 2 deletions yandextank/core/tests/test_tankcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ def setup_module(module):
(CFG1,
{'plugin_telegraf', 'plugin_phantom', 'plugin_lunapark',
'plugin_rcheck', 'plugin_shellexec', 'plugin_autostop',
'plugin_console', 'plugin_tips', 'plugin_rcassert', 'plugin_json_report',
'plugin_console', 'plugin_rcassert', 'plugin_json_report',
}),
(CFG2,
{'plugin_phantom', 'plugin_lunapark', 'plugin_rcheck',
'plugin_autostop', 'plugin_console', 'plugin_tips',
'plugin_autostop', 'plugin_console',
'plugin_rcassert', 'plugin_json_report',
}
)
Expand Down
1 change: 0 additions & 1 deletion yandextank/plugins/Appium/__init__.py

This file was deleted.

9 changes: 0 additions & 9 deletions yandextank/plugins/Appium/config/schema.yaml

This file was deleted.

75 changes: 0 additions & 75 deletions yandextank/plugins/Appium/plugin.py

This file was deleted.

1 change: 0 additions & 1 deletion yandextank/plugins/BatteryHistorian/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions yandextank/plugins/BatteryHistorian/config/schema.yaml

This file was deleted.

0 comments on commit e0a718d

Please sign in to comment.