本文整理汇总了Python中statsd.StatsClient._sock方法的典型用法代码示例。如果您正苦于以下问题:Python StatsClient._sock方法的具体用法?Python StatsClient._sock怎么用?Python StatsClient._sock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类statsd.StatsClient
的用法示例。
在下文中一共展示了StatsClient._sock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _udp_client
# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import _sock [as 别名]
def _udp_client(prefix=None, addr=None, port=None, ipv6=False):
if not addr:
addr = ADDR[0]
if not port:
port = ADDR[1]
sc = StatsClient(host=addr, port=port, prefix=prefix, ipv6=ipv6)
sc._sock = mock.Mock()
return sc
示例2: _udp_client
# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import _sock [as 别名]
def _udp_client(prefix=None, addr=None, port=None, ipv6=False):
if not addr:
addr = ADDR[0]
if not port:
port = ADDR[1]
sc = StatsClient(host=addr, port=port, prefix=prefix, ipv6=ipv6)
sc._pool = fake_socket_pool()
sc._sock = sc._pool.get()
return sc
示例3: test_disabled_client
# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import _sock [as 别名]
def test_disabled_client():
""" Assert that a cliend with disabled=True does not send any data to
statsd.
"""
sc = StatsClient(host=ADDR[0], port=ADDR[1], disable=True)
sc._sock = mock.Mock()
sc.incr('foo')
eq_(sc._sock.call_count, 0)
示例4: _client
# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import _sock [as 别名]
def _client(prefix=None):
sc = StatsClient(host=ADDR[0], port=ADDR[1], prefix=prefix)
sc._sock = mock.Mock()
return sc
示例5: _client
# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import _sock [as 别名]
def _client(prefix=None, batch_len=1):
sc = StatsClient(host=ADDR[0], port=ADDR[1], prefix=prefix, batch_len=batch_len)
sc._sock = mock.Mock()
return sc