所以我让 Etsy 的StatsD和 Graphite 在 OS X 10.9.3 上运行。
我现在正在尝试使用 Python 来实现它们,我不想使用python-statsd,因为我想在求助于库之前了解如何单独使用该技术(如果我需要使用 Ruby /PHP 稍后,然后我就不会理解基本机制)。
即我正在尝试使用 Python 将应用程序数据发送到 StatsD,然后将其显示在 Graphite 中。
在我的应用程序中,我使用的是 Steve Ivy 的python_example.py的精确副本。
在我的代码中,我这样调用增量函数:
from statsd import StatsdClient
client = StatsdClient()
client.increment('somename.someval')
这是引发的错误:
File "/Users/bengrunfeld/Desktop/Work/code/wf-ghconsole/console/statsd.py", line 163, in send
udp_sock.sendto(":".join(item).encode('utf-8'), addr)
....
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 234, in _MakeRealSyncCall
raise pickle.loads(response_pb.exception())
RuntimeError: error('illegal IP address string passed to inet_pton',)
以下是发送内容的值udp_sock.sendto
:
('somename.someval:1|c', ('localhost', 8125))
链接到我的代码:https ://github.com/bengrunfeld-wf/gae-github-console/blob/statsd/console/statsd.py