Skip to content

Instantly share code, notes, and snippets.

@eloraburns
Created October 9, 2015 14:33
Show Gist options
  • Save eloraburns/5c9c9b3a24ee97840f68 to your computer and use it in GitHub Desktop.
Save eloraburns/5c9c9b3a24ee97840f68 to your computer and use it in GitHub Desktop.
Statsd listener for debugging stats locally
# From https://wiki.python.org/moin/UdpCommunication modified for Statsd + debugging usage
import datetime
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 8125
sock = socket.socket(
socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print datetime.datetime.now(), data
@joseph-stano
Copy link

👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment