Commit graph

23 commits

Author SHA1 Message Date
Dave Shawley
a63733dcad
Remove debug log of "processing metric"
This is just way too noisy and provides zero value.
2023-07-27 08:32:03 -04:00
Dave Shawley
589412693e
Stop using generic typing for asyncio.Queue.
This feature isn't available in all versions of Python.
2021-07-21 12:23:53 -04:00
Dave Shawley
9054c729f5
Add some missing typing.
This doesn't completely appease pyright & mypy since I insist on calling
the sprockets.http.Application methods when guarded by isinstance()
checks.
2021-07-20 17:35:13 -04:00
Dave Shawley
65745010ad
Add datetime.timedelta support to timing. 2021-07-18 11:57:38 -04:00
Dave Shawley
1c6ba8f80e
Implement the python-statsd Timer interface. 2021-07-18 11:56:49 -04:00
Dave Shawley
75bb621784
Add Connector.timer.
This improves compatibility with python-statsd.
2021-07-18 11:26:34 -04:00
Dave Shawley
ed67689fe2
Limit logging when disconnected.
Instead of logging a warning every time that the connection fails, only
log the first 100 of them, then log every 100th time thereafter.
2021-05-09 16:21:34 -04:00
Dave Shawley
235c7bde3c
Add support for disabling tornado connector. 2021-04-12 08:08:07 -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
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
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
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
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
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