Skip to content

Commit 1178816

Browse files
committed
Merge branch 'release/v2.0.0'
2 parents 6310d88 + 508deeb commit 1178816

15 files changed

Lines changed: 114 additions & 45 deletions

.travis.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1+
sudo: false
12
language: python
2-
33
python:
44
- "2.6"
55
- "2.7"
6-
- "3.2"
7-
- "3.3"
86
- "3.4"
7+
- "3.5"
98
- "pypy"
109
- "pypy3"
1110

1211
# command to install dependencies
1312
install:
14-
- pip install . --use-mirrors
15-
- pip install coveralls --use-mirrors
13+
- pip install .
14+
- pip install coveralls flake8
1615

1716
# command to run tests
1817
script:
1918
- python setup.py nosetests --cover-erase --with-coverage
2019
- nosetests --with-coverage --cover-min-percentage=100
2120

21+
before_script: flake8 --ignore=W391 statsd tests
22+
2223
after_success:
2324
- coveralls
2425

README.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ Introduction
1616
`statsd` is a client for Etsy's statsd server, a front end/proxy for the
1717
Graphite stats collection and graphing server.
1818

19-
* Graphite
20-
- http://graphite.wikidot.com
21-
* Statsd
22-
- code: https://github.com/etsy/statsd
23-
- blog post: http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/
19+
Links
20+
-----
2421

22+
- The source: https://github.com/WoLpH/python-statsd
23+
- Project page: https://pypi.python.org/pypi/python-statsd
24+
- Reporting bugs: https://github.com/WoLpH/python-statsd/issues
25+
- Documentation: http://python-statsd.readthedocs.io/en/latest/
26+
- My blog: http://w.wol.ph/
27+
- Statsd: https://github.com/etsy/statsd
28+
- Graphite: http://graphite.wikidot.com
2529

2630
Install
2731
-------

docs/conf.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@
6363
# The full version, including alpha/beta/rc tags.
6464
release = statsd.__version__
6565

66+
# Monkey patch to disable nonlocal image warning
67+
import sphinx
68+
original_warn_mode = sphinx.environment.BuildEnvironment.warn_node
69+
70+
71+
def allow_nonlocal_image_warn_node(self, msg, node):
72+
if not msg.startswith('nonlocal image URI found:'):
73+
original_warn_mode(self, msg, node)
74+
75+
sphinx.environment.BuildEnvironment.warn_node = allow_nonlocal_image_warn_node
76+
77+
suppress_warnings = [
78+
'image.nonlocal_uri',
79+
]
80+
81+
needs_sphinx = '1.4'
82+
6683
# The language for content autogenerated by Sphinx. Refer to documentation
6784
# for a list of supported languages.
6885
#language = None
@@ -134,7 +151,7 @@
134151
# Add any paths that contain custom static files (such as style sheets) here,
135152
# relative to this directory. They are copied after the builtin static files,
136153
# so a file named "default.css" will overwrite the builtin "default.css".
137-
html_static_path = ['_static']
154+
#html_static_path = ['_static']
138155

139156
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
140157
# using the given strftime format.

docs/index.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
Python Statsd Client
22
=========================================
33

4+
`statsd` is a client for Etsy's statsd server, a front end/proxy for the
5+
Graphite stats collection and graphing server.
6+
7+
Links
8+
-----
9+
10+
- The source: https://github.com/WoLpH/python-statsd
11+
- Project page: https://pypi.python.org/pypi/python-statsd
12+
- Reporting bugs: https://github.com/WoLpH/python-statsd/issues
13+
- Documentation: http://python-statsd.readthedocs.io/en/latest/
14+
- My blog: http://w.wol.ph/
15+
- Statsd: https://github.com/etsy/statsd
16+
- Graphite: http://graphite.wikidot.com
17+
418
Contents:
519

620
.. toctree::
721
:maxdepth: 2
822

923
usage
10-
1124
statsd
1225

1326
Indices and tables

setup.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ all_files = 1
1919
[upload_sphinx]
2020
upload-dir = docs/_build/html
2121

22+
[bdist_wheel]
23+
universal = 1
24+
25+
[flake8]
26+
ignore = W391
27+
exclude = docs/*,statsd/compat.py

statsd/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
]
2020

2121
__package_name__ = 'python-statsd'
22-
__version__ = '1.7.2'
22+
__version__ = '2.0.0'
2323
__author__ = 'Rick van Hattem'
2424
__author_email__ = 'Wolph@wol.ph'
2525
__description__ = (
@@ -28,8 +28,8 @@
2828
__url__ = 'https://github.com/WoLpH/python-statsd'
2929

3030

31-
# The doctests in this package, when run, will try to send data on the wire. To
32-
# keep this from happening, we hook into nose's machinery to mock out
31+
# The doctests in this package, when run, will try to send data on the wire.
32+
# To keep this from happening, we hook into nose's machinery to mock out
3333
# `Connection.send` at the beginning of testing this package, and reset it at
3434
# the end.
3535
_connection_patch = None

statsd/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66

77
class Client(object):
8+
89
'''Statsd Client Object
910
1011
:keyword name: The name for this client
1112
:type name: str
12-
:keyword connection: The connection to use, will be automatically created if
13-
not given
13+
:keyword connection: The connection to use, will be automatically created
14+
if not given
1415
:type connection: :class:`~statsd.connection.Connection`
1516
1617
>>> client = Client('test')

statsd/compat.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
"""
2-
Compatability library for python2 and python3 support.
3-
"""
1+
'''
2+
Compatibility library for python2 and python3 support.
3+
'''
44
import sys
55
import decimal
66

77
PY3K = sys.version_info >= (3, 0)
88

9+
910
def iter_dict(dict_): # pragma: no cover
1011
if PY3K:
1112
return dict_.items()

statsd/gauge.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55

66
class Gauge(statsd.Client):
7-
'''Class to implement a statsd gauge
87

9-
'''
8+
'Class to implement a statsd gauge'
109

1110
def _send(self, subname, value):
1211
'''Send the data to statsd via self.connection
@@ -98,20 +97,22 @@ def __sub__(self, delta):
9897
return self
9998

10099
def set(self, subname, value):
101-
'''Set the data ignoring the sign, ie set("test", -1) will
102-
set "test" exactly to -1 (not decrement it by 1)
103-
104-
See
105-
https://github.com/etsy/statsd/blob/master/docs/metric_types.md
100+
'''
101+
Set the data ignoring the sign, ie set("test", -1) will set "test"
102+
exactly to -1 (not decrement it by 1)
103+
104+
See https://github.com/etsy/statsd/blob/master/docs/metric_types.md
106105
"Adding a sign to the gauge value will change the value, rather
107-
than setting it.
108-
gaugor:-10|g
109-
gaugor:+4|g
110-
So if gaugor was 333, those commands would set it to 333 - 10 + 4,
111-
or 327.
112-
Note:
113-
This implies you can't explicitly set a gauge to a negative number
114-
without first setting it to zero."
106+
than setting it.
107+
108+
gaugor:-10|g
109+
gaugor:+4|g
110+
111+
So if gaugor was 333, those commands would set it to 333 - 10 + 4, or
112+
327.
113+
114+
Note: This implies you can't explicitly set a gauge to a negative
115+
number without first setting it to zero."
115116
116117
:keyword subname: The subname to report the data to (appended to the
117118
client name)

statsd/timer.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import contextlib
22
import time
3-
from functools import wraps
3+
from functools import wraps, partial
44

55
import statsd
66

77

88
class Timer(statsd.Client):
9+
910
'''
1011
Statsd Timer Object
1112
@@ -14,11 +15,11 @@ class Timer(statsd.Client):
1415
1516
:keyword name: The name for this timer
1617
:type name: str
17-
:keyword connection: The connection to use, will be automatically created if
18-
not given
18+
:keyword connection: The connection to use, will be automatically created
19+
if not given
1920
:type connection: :class:`~statsd.connection.Connection`
20-
:keyword min_send_threshold: Timings smaller than this will not be sent so -1
21-
can be used for all.
21+
:keyword min_send_threshold: Timings smaller than this will not be sent so
22+
-1 can be used for all.
2223
:type min_send_threshold: int
2324
2425
>>> timer = Timer('application_name').start()
@@ -127,7 +128,7 @@ def decorate(self, function_or_name):
127128
if callable(function_or_name):
128129
return self._decorate(function_or_name.__name__, function_or_name)
129130
else:
130-
return lambda f: self._decorate(function_or_name, f)
131+
return partial(self._decorate, function_or_name)
131132

132133
@contextlib.contextmanager
133134
def time(self, subname=None, class_=None):

0 commit comments

Comments
 (0)