Sends key/value pairs via UDP. >>> StatsdClient.send({"example.send":"11|c"}, ("127.0.0.1", 8125))
(_dict, addr)
| 144 | |
| 145 | @staticmethod |
| 146 | def send(_dict, addr): |
| 147 | """ |
| 148 | Sends key/value pairs via UDP. |
| 149 | |
| 150 | >>> StatsdClient.send({"example.send":"11|c"}, ("127.0.0.1", 8125)) |
| 151 | """ |
| 152 | # TODO(rbtz@): IPv6 support |
| 153 | # TODO(rbtz@): Creating socket on each send is a waste of resources |
| 154 | udp_sock = socket(AF_INET, SOCK_DGRAM) |
| 155 | # TODO(rbtz@): Add batch support |
| 156 | for item in _dict.items(): |
| 157 | udp_sock.sendto(":".join(item).encode('utf-8'), addr) |
no outgoing calls
no test coverage detected