def setUp(self):
    interface.state = interface.State()
    interface.state.metric_name_prefix = '/infra/test/'
    interface.state.target = targets.TaskTarget(
        service_name='service', job_name='job', region='region',
        hostname='hostname', task_num=0)

    interface.state.store = metric_store.InProcessMetricStore(
        interface.state, time.time)
Beispiel #2
0
    def setUp(self):
        interface.state = interface.State()
        interface.state.metric_name_prefix = '/infra/test/'
        interface.state.target = targets.TaskTarget(service_name='service',
                                                    job_name='job',
                                                    region='region',
                                                    hostname='hostname',
                                                    task_num=0)

        self.time_fn = mock.create_autospec(time.time, spec_set=True)
        interface.state.store = metric_store.InProcessMetricStore(
            interface.state, self.time_fn)
Beispiel #3
0
 def __init__(self):
     # The Monitor object that will be used to send all metrics.
     self.global_monitor = None
     # The Target object that will be paired with all metrics that don't supply
     # their own.
     self.target = None
     # The flush mode being used to control when metrics are pushed.
     self.flush_mode = None
     # The background thread that flushes metrics every
     # --ts-mon-flush-interval-secs seconds.  May be None if
     # --ts-mon-flush != 'auto' or --ts-mon-flush-interval-secs == 0.
     self.flush_thread = None
     # All metrics created by this application.
     self.metrics = {}
     # The MetricStore object that holds the actual metric values.
     self.store = metric_store.InProcessMetricStore(self)
Beispiel #4
0
  def setUp(self):
    super(TestBase, self).setUp()
    target = targets.TaskTarget('test_service', 'test_job',
                                'test_region', 'test_host')
    self.mock_state = interface.State(target=target)
    self.state_patcher = mock.patch('infra_libs.ts_mon.common.interface.state',
                                    new=self.mock_state)
    self.state_patcher.start()

    self.mock_state.target = targets.TaskTarget(
        service_name='service', job_name='job', region='region',
        hostname='hostname', task_num=0)

    self.time_fn = mock.create_autospec(time.time, spec_set=True)
    self.mock_state.store = metric_store.InProcessMetricStore(
        self.mock_state, self.time_fn)