Commit graph

83 commits

Author SHA1 Message Date
Ryan Mclean
a0e2ef1c19
Merge pull request #1 from sprockets/syn
Initial implementation
2021-04-05 14:06:12 -04:00
Dave Shawley
0d911fc3e2
Enable codecov upload. 2021-03-30 08:29:48 -04:00
Dave Shawley
5a52437857
Remove coverage from tox.ini.
This makes running in parallel work properly.
2021-03-30 08:10:24 -04:00
Dave Shawley
51e1f2ccae
Make type annotations safe for Python 3.7. 2021-03-30 08:09:53 -04:00
Dave Shawley
da95efa544
Move path prefixing into Connector.
This makes the low-level code a little more opinionated.  If there is a
good reason for making `timers`, `counters`, etc. optional, then we can
PR it into place.
2021-03-30 07:56:20 -04:00
Dave Shawley
0f0bae1199
Set upper bound on metrics queue size. 2021-03-30 07:22:22 -04:00
Dave Shawley
5c947d6798
Make docs a little cleaner. 2021-03-29 07:46:23 -04:00
Dave Shawley
2ecdee61c4
Clean up type annotations.
This almost makes mypy happy.  I did manage to step on a defect that
there really isn't a great workaround for so I resorted to disabling
typing there.

https://github.com/python/mypy/issues/2427
2021-03-29 07:46:12 -04:00
Dave Shawley
b84e52592d
Prefix management -- take two.
Agree with @aremm here ... instead of requiring contortions to run
without a prefix, let's just require that it is explicitly set to `None`
if you want to skip the prefix.  If you `prefix` isn't in the settings
explicitly, then use `$STATSD_PREFIX` if it is set; otherwise, try to
construct a prefix from service & environment, if that fails, then fail
hard in the initializer.
2021-03-24 08:10:07 -04:00
Dave Shawley
65df480421
Expose a more usable interface on the Connector.
@nvllsvm likes the interface that https://statsd.readthedocs.io/ exposes
and I agree.  I mimicked this interface on the lower-level Connector.  I
left the sprockets.mixins.metrics style on the tornado helpers for
compat reasons.  You can always use `self.statsd_connector.incr()` in
your request handlers if you prefer the other interface.
2021-03-24 07:41:06 -04:00
Dave Shawley
e5c343e577
Verify 100% coverage in local tox. 2021-03-24 07:35:49 -04:00
Dave Shawley
2aeddc8bc3
Rename mixins module to tornado.
Tried to make it clear that tornado is an optional requirement.
2021-03-24 06:54:24 -04:00
Dave Shawley
7ee536e99f
Fix test error. 2021-03-24 06:30:26 -04:00
Dave Shawley
9a8f23c614
Require prefix unless allow_no_prefix is set. 2021-03-23 22:01:27 -04:00
Dave Shawley
f6017d1a06
Add $STATSD_PREFIX support. 2021-03-23 22:01:02 -04:00
Dave Shawley
05650286da
Remove usage of typing.Protocol.
It wasn't adding too much and it isn't available in Python 3.7.
2021-03-23 21:21:16 -04:00
Dave Shawley
c634c20906
Expose UDP support in the mixins. 2021-03-23 07:58:45 -04:00
Dave Shawley
c4c44f9864
Add support for UDP sockets. 2021-03-23 07:57:32 -04:00
Dave Shawley
38a5e3f566
Refactor to pull out TCP details.
This will make it easier to add the UDP protocol.
2021-03-23 07:57:32 -04:00
Dave Shawley
6d310db517
Move statsd connector to attribute.
Since @aremm still believes that `Application.settings` should only be
used for configuration and not for state ;)
2021-03-23 07:57:32 -04:00
Dave Shawley
69dfb51bf8
Rework application prefix configuration.
Use a default of `None` instead of `applications` if the neither service
nor environment keys are set.
2021-03-23 07:57:27 -04:00
Dave Shawley
63dc44fd22
Ensure that docs build as part of CI. 2021-03-11 07:43:17 -05:00
Dave Shawley
28e369c122
Make timeout parameters configurable. 2021-03-11 07:31:24 -05:00
Dave Shawley
65b5bacbee
Reorder logic to emphasize common paths.
I snuck in a call to verify that the connected event is set before the
call to _process_metric.  This closes a small loophole where the
transport could be None inside of _process_metric.
2021-03-11 07:03:18 -05:00
Dave Shawley
00759ed20b
Correct some resource leaks in tests. 2021-03-10 07:16:47 -05:00
Dave Shawley
4360bc298a
Run style, lint, and unittests using GH actions.
There is some commented out code for code coverage reporting that can be
enabled after this repo is publicised.
2021-03-10 07:14:21 -05:00
Dave Shawley
f8c63a55fc
Switch to asynctest for Py 3.7 support.
Decided to switch the tests to using asynctest so that we can guarantee
support on Python 3.7 and newer.  Also added pins in setup.cfg and a
tox.ini file if you want to use it.
2021-03-10 06:46:17 -05:00
Dave Shawley
720dd79193
Add Application & RequestHandler mixins. 2021-03-10 06:46:06 -05:00
Dave Shawley
0d5b212efc
Add docs, rename a few things. 2021-03-08 07:36:33 -05:00
Dave Shawley
ed6e479e2a
Make statsd metric sending resilient. 2021-03-08 07:36:32 -05:00
Dave Shawley
ff6f13591c
Send metrics asynchronously. 2021-03-08 07:36:32 -05:00
Dave Shawley
9febb7e7e8
statsd.Processor that reconnects. 2021-03-08 07:36:32 -05:00
Dave Shawley
832f8af7e0
Project scaffolding. 2021-03-08 07:35:31 -05:00