Beispiel #1
0
    def test_filtering_vars_filter_enabled_and_not_requested(self):
        rm = RootMetrics()
        zone = NamedGauge('alpha', "wont_be_visible")
        alpha = NamedGauge('zone', "smf1")
        rm.register(zone)
        rm.register(alpha)

        metrics = RootMetrics()
        vars_subsystem = VarsSubsystem()
        regex = vars_subsystem.compile_stats_filters(["alpha", "beta.*"])
        endpoint = VarsEndpoint(period=Amount(60000, Time.MILLISECONDS),
                                stats_filter=regex)
        metrics_returned = endpoint.handle_vars_json()
        assert "zone" in metrics_returned
        assert "alpha" in metrics_returned
        request.GET.replace('filtered', None)
Beispiel #2
0
 def __init__(self, clock=time):
   self._clock = clock
   self._self = psutil.Process(os.getpid())
   try:
     self._version = self.get_release_from_binary(
       os.path.join(self._self.cwd(), self._self.cmdline()[1]))
   except (IndexError, psutil.Error):
     self._version = 'UNKNOWN'
   self.metrics.register(NamedGauge('version', self._version))
   self._orphan = False
   self.metrics.register(LambdaGauge('orphan', lambda: int(self._orphan)))
   self._metrics = dict((metric, MutatorGauge(metric, 0)) for metric in self.MUTATOR_METRICS)
   for metric in self._metrics.values():
     self.metrics.register(metric)
   ExceptionalThread.__init__(self)
   self.daemon = True
 def start(self):
     """Invoked once the task has been started."""
     self.metrics.register(NamedGauge('enabled', 1))
Beispiel #4
0
 def __init__(self, name):
   self._supplies = []
   NamedGauge.__init__(self, name)