Skip to content

Commit

Permalink
merged with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Zehta committed Sep 18, 2013
2 parents e9f7a7d + a661259 commit 8717f3f
Show file tree
Hide file tree
Showing 22 changed files with 654 additions and 114 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: python
python:
- "2.5"
- "2.6"
- "2.7"

# command to install dependencies
install:
- "pip install -r requirements.txt --use-mirrors"
- "python setup.py -q install"
# command to run tests
script: nosetests tests
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.md
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

pypi:
python setup.py sdist upload
40 changes: 31 additions & 9 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
Introduction
------------

pystatsd is a client and server implementation of Etsy's brilliant statsd
**pystatsd** is a client and server implementation of Etsy's brilliant statsd
server, a front end/proxy for the Graphite stats collection and graphing server.

* Graphite
- http://graphite.wikidot.com
* Statsd
* Statsd
- code: https://github.com/etsy/statsd
- blog post: http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/

**pystatsd** has [been tested on](http://travis-ci.org/sivy/py-statsd) python 2.5, 2.6, and 2.7.

Status
-------------

Reviewing and merging pull requests, bringing stuff up to date, now with tests!

[![Build Status](https://secure.travis-ci.org/sivy/py-statsd.png?branch=master)](http://travis-ci.org/sivy/py-statsd)



Usage
-------------

Expand All @@ -25,6 +36,7 @@ See statsd_test for sample usage:
sc.timing('python_test.time',500)
sc.increment('python_test.inc_int')
sc.decrement('python_test.decr_int')
sc.gauge('python_test.gauge', 42)


Building a Debian Package
Expand All @@ -34,12 +46,22 @@ To build a debian package, run `dpkg-buildpackage -rfakeroot`

Upstart init Script
-------------
Upstart is the daemon management system for Ubuntu, and it's really great!
Upstart is the daemon management system for Ubuntu.

A basic upstart script has been included for the pystatsd server. It's located
under init/, and will be installed to /usr/share/doc if you build/install a
.deb file. The upstart script should be copied to /etc/init/pystatsd.conf and
will read configuration variables from /etc/default/pystatsd. By default the
pystatsd daemon runs as user 'nobody' which is a good thing from a security
perspective.

Troubleshooting
-------------

You can see the raw values received by pystatsd by packet sniffing:

$ sudo ngrep -qd any . udp dst port 8125

A basic upstart script has been included for the pystatsd server. It's located
under init/, and will be installed to /usr/share/doc if you build/install a
.deb file. The upstart script should be copied to /etc/init/pystatsd.conf and
will read configuration variables from /etc/default/pystatsd. By default the
pystatsd daemon runs as user 'nobody' which is a good thing from a security
perspective.
You can see the raw values dispatched to carbon by packet sniffing:

$ sudo ngrep -qd any stats tcp dst port 2003
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
python-statsd (1.0-4) testing; urgency=low

* update to 36a59d3b126ded4658aff25bce94e844a1c6413e
* Fix path to README file

-- Bruno Clermont <bruno.clermont@gmail.com> Wed, 15 Aug 2012 15:01:00 +0200

python-statsd (1.0-2) UNRELEASED; urgency=low

[ Rob Terhaar ]
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Maintainer: Rob Terhaar <rob@atlanticdynamic.com>
Section: python
Priority: optional
Standards-Version: 3.8.3
Build-Depends: debhelper (>= 7.3), python-support (>= 1.0.3), python
XS-Python-Version: all
Build-Depends: debhelper (>= 7.3), python-support (>= 1.0.3), python, python-setuptools
XS-Python-Version: >= 2.6
Vcs-Git: https://github.com/robbyt/py-statsd
Vcs-Browser: https://github.com/robbyt/py-statsd
Homepage: https://github.com/robbyt/py-statsd
Expand Down
6 changes: 3 additions & 3 deletions debian/python-statsd.docs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
README
init/pystatd.conf.upstart
init/pystatd.default
README.md
init/pystatsd.conf.upstart
init/pystatsd.default
2 changes: 1 addition & 1 deletion init/pystatsd.conf.upstart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pystatsd upstart script
# 2011 - rob@atlanticdynamic.com
# Copy this to /etc/init/pystatsd.conf
# copy this to /etc/init/pystatsd.conf
#

description "start and stop the py-statsd server"
Expand Down
12 changes: 6 additions & 6 deletions init/pystatsd.default
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# config file template for pystatsd.
# config file template for pystatd.
# copy this to /etc/default/pystatsd and the included upstart or init.d script,
# will read daemon settings from this file
#
LOCAL_PYSTATD_PORT=8125 # port to run on (default: 8125)
PCT=90 # stats pct threshold (default: 90)
GRAPHITE_HOST=localhost # host to connect to graphite on (default: localhost)
GRAPHITE_PORT=2003 # port to connect to graphite on (default: 2003)
USER=nobody # user to run pystatsd as
LOCAL_PYSTATD_PORT=8125
PCT=90
GRAPHITE_HOST=localhost #this is your graphite server
GRAPHITE_PORT=2003 #port that carbon-cache is running on
USER=nobody
2 changes: 1 addition & 1 deletion pystatsd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from statsd import Client
from server import Server

VERSION = (0, 1, 7)
VERSION = (0, 1, 10)
4 changes: 3 additions & 1 deletion pystatsd/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Based on http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
"""

from __future__ import with_statement

import atexit
import os
from signal import SIGTERM
Expand Down Expand Up @@ -33,7 +35,7 @@ def daemonize(self):
# Disconnect from parent environment.
os.chdir('/')
os.setsid()
os.umask(0)
os.umask(0022)

# Fork again.
try:
Expand Down
Loading

0 comments on commit 8717f3f

Please sign in to comment.