Skip to content

Commit

Permalink
Merge pull request #24 from uber/fix_latency
Browse files Browse the repository at this point in the history
Store measure_interval correctly
  • Loading branch information
jeevandev committed Jul 19, 2016
2 parents 72f51f8 + 52ea7d3 commit dfcddf8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mutornadomon/monitor.py
Expand Up @@ -42,6 +42,8 @@ def __init__(
self.collectors = collectors
self.io_loop = io_loop or tornado.ioloop.IOLoop.current()

self.measure_interval = measure_interval

self.measure_callback = tornado.ioloop.PeriodicCallback(
self._cb,
measure_interval,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -2,3 +2,4 @@ tornado>=3.0
psutil>=1.2.0
mock>=0.9
six
ipcalc
11 changes: 11 additions & 0 deletions tests/test_config.py
Expand Up @@ -6,6 +6,7 @@
import tornado.ioloop
import unittest

from mutornadomon import MuTornadoMon
from mutornadomon.config import initialize_mutornadomon
from mutornadomon.external_interfaces import (HTTPEndpointExternalInterface,
PublishExternalInterface)
Expand Down Expand Up @@ -118,3 +119,13 @@ def test_initialize_mutornadomon_raises_when_no_publisher_and_no_app(self, perio
"""Test instrument_ioloop() setups monitoring and creates a PeriodicCallback"""
self.assertRaises(ValueError, initialize_mutornadomon,
io_loop=tornado.ioloop.IOLoop.current())

@mock.patch('mutornadomon.external_interfaces.PublishExternalInterface')
def test_initialize_MuTornadoMon(self, pub_ext_iface_mock):
external_interface = pub_ext_iface_mock.return_value
monitor = MuTornadoMon(external_interface)

#check if no exceptions are raised
monitor.start()
monitor._cb()
monitor.stop()

0 comments on commit dfcddf8

Please sign in to comment.