Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #819 from yandex/develop
Release 1.12.6
- Loading branch information
Showing
22 changed files
with
759 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
yandextank/plugins/InfluxUploader/tests/test_influxdb_decoder.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# -*- coding: utf-8 -*- | ||
from uuid import uuid4 | ||
from yandextank.plugins.InfluxUploader.decoder import Decoder | ||
|
||
|
||
class TestDecoder(object): | ||
def test_metrics_cast(self): | ||
test_uuid = str(uuid4()) | ||
tank_tag = 'test_tank_tag' | ||
comment = 'test comment' | ||
raw_metrics = { | ||
'metric1': -123, | ||
'metric2': -123.456, | ||
'metric3': 123, | ||
'metric4': 123.456, | ||
'metric5': 0, | ||
'metric6': -0.1, | ||
'metric7': 0.1, | ||
'metric8': 'down', | ||
} | ||
timestamp = 123456789 | ||
host = '127.0.0.1' | ||
data = [ | ||
{ | ||
'data': { | ||
host: { | ||
'comment': comment, | ||
'metrics': raw_metrics | ||
} | ||
}, | ||
'timestamp': timestamp | ||
} | ||
] | ||
expected_metrics = { | ||
'metric1': -123.0, | ||
'metric2': -123.456, | ||
'metric3': 123.0, | ||
'metric4': 123.456, | ||
'metric5': 0.0, | ||
'metric6': -0.1, | ||
'metric7': 0.1, | ||
'metric8': 'down' | ||
} | ||
|
||
decoder = Decoder(tank_tag, test_uuid, {}, True, True) | ||
result_points = decoder.decode_monitoring(data) | ||
|
||
assert (len(result_points) == 1) | ||
r_point = result_points[0] | ||
# check other props | ||
assert (r_point['time'] == timestamp) | ||
assert (r_point['measurement'] == 'monitoring') | ||
assert (r_point['tags']['comment'] == comment) | ||
assert (r_point['tags']['host'] == host) | ||
assert (r_point['tags']['tank'] == tank_tag) | ||
assert (r_point['tags']['uuid'] == test_uuid) | ||
# check metric cast | ||
assert (len(r_point['fields']) == len(expected_metrics)) | ||
for metric, value in r_point['fields'].iteritems(): | ||
if metric not in expected_metrics: | ||
assert False | ||
if not isinstance(value, type(expected_metrics[metric])): | ||
assert False | ||
if not value == expected_metrics[metric]: | ||
assert False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .plugin import Plugin # noqa:F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .client import OpenTSDBClient # noqa:F401 |
Oops, something went wrong.