本文整理汇总了Python中socorrolib.lib.util.DotDict.statsd_host方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.statsd_host方法的具体用法?Python DotDict.statsd_host怎么用?Python DotDict.statsd_host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorrolib.lib.util.DotDict
的用法示例。
在下文中一共展示了DotDict.statsd_host方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_statistics_all_missing_prefix
# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import statsd_host [as 别名]
def test_statistics_all_missing_prefix(self):
d = DotDict()
d.statsd_host = 'localhost'
d.statsd_port = 666
d.prefix = None
d.active_counters_list = ['x', 'y', 'z']
with patch('socorrolib.lib.statistics.StatsClient') as StatsClientMocked:
s = StatisticsForStatsd(d, 'processor')
StatsClientMocked.assert_called_with(
'localhost', 666, 'processor')
s.incr('x')
StatsClientMocked.assert_has_calls(
StatsClientMocked.mock_calls,
[call.incr('processor.x')]
)
s.incr('y')
StatsClientMocked.assert_has_calls(
StatsClientMocked.mock_calls,
[call.incr('processor.y')]
)
s.incr('z')
StatsClientMocked.assert_has_calls(
StatsClientMocked.mock_calls,
[call.incr('processor.z')]
)
s.incr('w')
StatsClientMocked.assert_has_calls(
StatsClientMocked.mock_calls,
[
call.incr('processor.y'),
call.incr('processor.x'),
call.incr('processor.y')
]
)
s.incr(None)
StatsClientMocked.assert_has_calls(
StatsClientMocked.mock_calls,
[
call.incr('processor.y'),
call.incr('processor.x'),
call.incr('processor.y'),
call.incr('processor.unknown')
]
)