mirror of
https://github.com/sprockets/sprockets.mixins.metrics.git
synced 2024-11-22 03:00:25 +00:00
Merge pull request #17 from sprockets/fix-adding-tags-in-initialize
Fix adding tags in initialize
This commit is contained in:
commit
cfb9157387
5 changed files with 21 additions and 6 deletions
|
@ -56,15 +56,15 @@ implements the same interface:
|
|||
|
||||
Statsd Implementation
|
||||
---------------------
|
||||
.. autoclass:: sprockets.mixins.metrics.StatsdMixin
|
||||
.. autoclass:: sprockets.mixins.metrics.statsd.StatsdMixin
|
||||
:members:
|
||||
|
||||
InfluxDB Implementation
|
||||
-----------------------
|
||||
.. autoclass:: sprockets.mixins.metrics.InfluxDBMixin
|
||||
.. autoclass:: sprockets.mixins.metrics.influxdb.InfluxDBMixin
|
||||
:members:
|
||||
|
||||
.. autoclass:: sprockets.mixins.metrics.influxdb.InfluxDBConnection
|
||||
.. autoclass:: sprockets.mixins.metrics.influxdb.InfluxDBCollector
|
||||
:members:
|
||||
|
||||
Testing Helpers
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
Release History
|
||||
===============
|
||||
|
||||
`2.0.1`_ (21-Mar-2016)
|
||||
----------------------
|
||||
- Make it possible to call methods (e.g.,
|
||||
:meth:`~sprockets.mixins.metrics.influxdb.InfluxDBMixin.set_metric_tag`)
|
||||
during the Tornado request handler initialization phase.
|
||||
|
||||
`2.0.0`_ (11-Mar-2016)
|
||||
----------------------
|
||||
- Rework InfluxDB buffering to use a periodic callback instead of flushing
|
||||
|
@ -34,7 +40,8 @@ Release History
|
|||
- Add :class:`sprockets.mixins.metrics.InfluxDBMixin`
|
||||
- Add :class:`sprockets.mixins.metrics.influxdb.InfluxDBConnection`
|
||||
|
||||
.. _Next Release: https://github.com/sprockets/sprockets.mixins.metrics/compare/2.0.0...master
|
||||
.. _Next Release: https://github.com/sprockets/sprockets.mixins.metrics/compare/2.0.1...master
|
||||
.. _2.0.1: https://github.com/sprockets/sprockets.mixins.metrics/compare/2.0.0...2.0.1
|
||||
.. _2.0.0: https://github.com/sprockets/sprockets.mixins.metrics/compare/1.1.1...2.0.0
|
||||
.. _1.1.1: https://github.com/sprockets/sprockets.mixins.metrics/compare/1.1.0...1.1.1
|
||||
.. _1.1.0: https://github.com/sprockets/sprockets.mixins.metrics/compare/1.0.1...1.1.0
|
||||
|
|
|
@ -31,6 +31,10 @@ class SimpleHandler(influxdb.InfluxDBMixin, web.RequestHandler):
|
|||
|
||||
"""
|
||||
|
||||
def initialize(self):
|
||||
super(SimpleHandler, self).initialize()
|
||||
self.set_metric_tag('environment', 'testing')
|
||||
|
||||
@gen.coroutine
|
||||
def prepare(self):
|
||||
maybe_future = super(SimpleHandler, self).prepare()
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version_info = (2, 0, 0)
|
||||
version_info = (2, 0, 1)
|
||||
__version__ = '.'.join(str(v) for v in version_info)
|
||||
__all__ = ['__version__', 'version_info']
|
||||
|
|
|
@ -20,7 +20,6 @@ class InfluxDBMixin(object):
|
|||
"""Mix this class in to record measurements to a InfluxDB server."""
|
||||
|
||||
def __init__(self, application, request, **kwargs):
|
||||
super(InfluxDBMixin, self).__init__(application, request, **kwargs)
|
||||
self.__metrics = []
|
||||
self.__tags = {
|
||||
'handler': '{}.{}'.format(self.__module__,
|
||||
|
@ -28,6 +27,11 @@ class InfluxDBMixin(object):
|
|||
'method': request.method,
|
||||
}
|
||||
|
||||
# Call to super().__init__() needs to be *AFTER* we create our
|
||||
# properties since it calls initialize() which may want to call
|
||||
# methods like ``set_metric_tag``
|
||||
super(InfluxDBMixin, self).__init__(application, request, **kwargs)
|
||||
|
||||
def set_metric_tag(self, tag, value):
|
||||
"""
|
||||
Add a tag to the measurement key.
|
||||
|
|
Loading…
Reference in a new issue