Skip to content

Commit

Permalink
Merge pull request #599 from yandex/release
Browse files Browse the repository at this point in the history
fixes from release
  • Loading branch information
fomars committed May 24, 2018
2 parents 64165e8 + 54bfa48 commit c12519c
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 6 deletions.
38 changes: 37 additions & 1 deletion docs/config_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,10 @@ Phantom
--------------------------
*\- Object's type, that has a functionality to create test requests. Default:* ``method_stream``

``name`` (string)
-----------------
*\- Name of a part in multi config.* **Required.**

``phantom_http_entity`` (string)
--------------------------------
*\- Limits the amount of bytes Phantom reads from response. Default:* ``8M``
Expand Down Expand Up @@ -924,4 +928,36 @@ Telegraf
``10s``
10 seconds
``2m``
2 minutes
2 minutes

YASM
====

``panels`` (dict)
-----------------
*\- (no description).* **Required.**

:valueschema:
:schema:
:default_signals:
:default:
True
:type:
boolean
:host:
:required:
True
:type:
string
:signals:
:required:
False
:type:
list
:tags:
:required:
True
:type:
string
:type:
dict
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[pytest]
norecursedirs = build dist .eggs .tox .env tmp .env3
testpaths = yandextank/validator
;testpaths = yandextank/validator
2 changes: 1 addition & 1 deletion yandextank/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def resolve(self, address_str, do_test=False, explicit_port=False):
resolved = self.lookup_fn(address_str, port)
logger.debug("Lookup result: %s", resolved)
except Exception:
logger.debug("Exception trying to resolve hostname %s : %s", address_str, exc_info=True)
logger.debug("Exception trying to resolve hostname %s :", address_str, exc_info=True)
raise

for (family, socktype, proto, canonname, sockaddr) in resolved:
Expand Down
11 changes: 10 additions & 1 deletion yandextank/plugins/Phantom/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@
'type': 'string',
'default': 'method_stream'
},
'name': {
'description': 'Name of a part in multi config',
'type': 'string',
'required': False
},
'phantom_http_entity': {
'type': 'string',
'default': '8M',
Expand Down Expand Up @@ -297,11 +302,15 @@
}
}


MULTI_OPTIONS = {n: {k: v for k, v in d.items() if k != 'required' and k != 'default'} for n, d in OPTIONS.items()}


MULTI = {
'multi': {
'type': 'list',
'allow_unknown': True,
'schema': OPTIONS,
'schema': {'type': 'dict', 'schema': MULTI_OPTIONS},
'default': []}
}

Expand Down
7 changes: 6 additions & 1 deletion yandextank/plugins/YASM/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ def __init__(self, panels):
self.panels = [self.Panel(alias, **attrs) for alias, attrs in panels.items()]

def as_dict(self):
return {panel.host: {panel.tags: panel.signals} for panel in self.panels}
yasmapi_cfg = {}
for panel in self.panels:
yasmapi_cfg.setdefault(panel.host, {})[panel.tags] = panel.signals
logger.info('yasmapi cfg: {}'.format(yasmapi_cfg))
return yasmapi_cfg

class Panel(object):
def __init__(self, alias, host, tags, signals=None, default_signals=True):
Expand All @@ -83,6 +87,7 @@ def __init__(self, alias, host, tags, signals=None, default_signals=True):
self.tags = tags
if len(self.signals) == 0:
logger.warning('No signals specified for {} panel'.format(self.alias))
self.dict_cfg = {self.host: {self.tags: self.signals}}


class ImmutableDict(dict):
Expand Down
3 changes: 2 additions & 1 deletion yandextank/validator/tests/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ def test_load_multiple(configs, expected):
'header_http': '1.1',
'uris': ['/'],
'load_profile': {'load_type': 'rps', 'schedule': 'line(1, 10, 10m)'},
'multi': [{'name': 'foo'}],
}
},
{
Expand Down Expand Up @@ -434,7 +435,7 @@ def test_load_multiple(configs, expected):
'loop': -1,
'port': '',
'use_caching': True,
'multi': [],
'multi': [{'name': 'foo'}],
'load_profile': {'load_type': 'rps', 'schedule': 'line(1, 10, 10m)'}
}
}
Expand Down

0 comments on commit c12519c

Please sign in to comment.