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