def pools_controller(self): controller = controllers.PoolsController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_management_store): return profiler.trace_cls("redis_pools_controller")(controller) else: return controller
def claim_controller(self): controller = controllers.ClaimController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_message_store): return profiler.trace_cls("swift_claim_controller")(controller) else: return controller
def subscription_controller(self): controller = SubscriptionController(self._pool_catalog) if self.conf.profiler.enabled: return (profiler.trace_cls("pooling_subscription_controller") (controller)) else: return controller
def __init__(self, conf, cache, control, control_driver=None): super(DataDriver, self).__init__(conf, cache, control_driver) catalog = Catalog(conf, cache, control) if self.conf.profiler.enabled: catalog = profiler.trace_cls("pooling_catalogue_" "controller")(catalog) self._pool_catalog = catalog
def pools_controller(self): controller = controllers.PoolsController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_management_store): return profiler.trace_cls("mongodb_pools_controller")(controller) else: return controller
def __init__(self, host, binary, topic, manager, report_interval=None, periodic_interval=None, periodic_fuzzy_delay=None, service_name=None, *args, **kwargs): super(Service, self).__init__() if not rpc.initialized(): rpc.init(CONF) self.host = host self.binary = binary self.topic = topic self.manager_class_name = manager manager_class = importutils.import_class(self.manager_class_name) manager_class = profiler.trace_cls("rpc")(manager_class) self.manager = manager_class(host=self.host, service_name=service_name, *args, **kwargs) self.report_interval = report_interval self.periodic_interval = periodic_interval self.periodic_fuzzy_delay = periodic_fuzzy_delay self.basic_config_check() self.saved_args, self.saved_kwargs = args, kwargs self.timers = [] setup_profiler(binary, host) self.rpcserver = None
def message_controller(self): controller = controllers.FIFOMessageController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_message_store): return profiler.trace_cls("mongodb_message_controller")(controller) else: return controller
def flavors_controller(self): controller = controllers.FlavorsController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_management_store): return profiler.trace_cls("redis_flavors_controller")(controller) else: return controller
def flavors_controller(self): controller = controllers.FlavorsController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_management_store): return profiler.trace_cls("mongodb_flavors_controller")(controller) else: return controller
def message_controller(self): controller = controllers.MessageController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_message_store): return profiler.trace_cls("redis_message_controller")(controller) else: return controller
def catalogue_controller(self): controller = controllers.CatalogueController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_management_store): return profiler.trace_cls("redis_catalogue_" "controller")(controller) else: return controller
def queue_controller(self): controller = controllers.QueueController(self) if (self.conf.profiler.enabled and (self.conf.profiler.trace_message_store or self.conf.profiler.trace_management_store)): return profiler.trace_cls("redis_queue_controller")(controller) else: return controller
def queue_controller(self): controller = controllers.QueueController(self) if (self.conf.profiler.enabled and (self.conf.profiler.trace_message_store or self.conf.profiler.trace_management_store)): return profiler.trace_cls("mongodb_queues_controller")(controller) else: return controller
def catalogue_controller(self): controller = controllers.CatalogueController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_management_store): return profiler.trace_cls("mongodb_catalogue_" "controller")(controller) else: return controller
def subscription_controller(self): controller = controllers.SubscriptionController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_message_store): return profiler.trace_cls("mongodb_subscription_" "controller")(controller) else: return controller
def topic_controller(self): controller = controllers.TopicController(self) if (self.conf.profiler.enabled and (self.conf.profiler.trace_message_store or self.conf.profiler.trace_management_store)): return profiler.trace_cls("mongodb_topics_controller")(controller) else: return controller
def subscription_controller(self): controller = controllers.SubscriptionController(self) if (self.conf.profiler.enabled and self.conf.profiler.trace_message_store): return profiler.trace_cls("swift_subscription_" "controller")(controller) else: return controller
def load_storage_driver(conf, cache, storage_type=None, control_mode=False, control_driver=None): """Loads a storage driver and returns it. The driver's initializer will be passed conf and cache as its positional args. :param conf: Configuration instance to use for loading the driver. Must include a 'drivers' group. :param cache: Cache instance that the driver can (optionally) use to reduce latency for some operations. :param storage_type: The storage_type to load. If None, then the `drivers` option will be used. :param control_mode: (Default False). Determines which driver type to load; if False, the data driver is loaded. If True, the control driver is loaded. :param control_driver: (Default None). The control driver instance to pass to the storage driver. Needed to access the queue controller, mainly. """ if control_mode: mode = 'control' storage_type = storage_type or conf['drivers'].management_store else: mode = 'data' storage_type = storage_type or conf['drivers'].message_store driver_type = 'zaqar.{0}.storage'.format(mode) _invoke_args = [conf, cache] if control_driver is not None: _invoke_args.append(control_driver) try: mgr = driver.DriverManager(driver_type, storage_type, invoke_on_load=True, invoke_args=_invoke_args) if conf.profiler.enabled: if ((mode == "control" and conf.profiler.trace_management_store) or (mode == "data" and conf.profiler.trace_message_store)): trace_name = '{0}_{1}_driver'.format(storage_type, mode) return profiler.trace_cls(trace_name, trace_private=True)(mgr.driver) else: return mgr.driver except Exception as exc: LOG.error( _LE('Failed to load "{}" driver for "{}"').format( driver_type, storage_type)) LOG.exception(exc) raise errors.InvalidDriver(exc)
def __init__(self, host, manager_module, manager_class): super(RPCService, self).__init__() self.host = host manager_module = importutils.try_import(manager_module) manager_class = getattr(manager_module, manager_class) _manager = manager_class(host, manager_module.MANAGER_TOPIC) self.manager = profiler.trace_cls("rpc")(_manager) self.topic = self.manager.topic self.rpcserver = None self.deregister = True setup_profiler.setup('rpc', self.host)
def __init__(self, host=None, binary=None, topic=None, manager=None, rpc_api_version=None): super(RpcService, self).__init__() self.host = host or CONF.host self.binary = binary or os.path.basename(inspect.stack()[-1][1]) self.topic = topic or self.binary.rpartition('trove-')[2] _manager = importutils.import_object(manager) self.manager_impl = profiler.trace_cls("rpc")(_manager) self.rpc_api_version = rpc_api_version or \ self.manager_impl.RPC_API_VERSION profile.setup_profiler(self.binary, self.host)
def storage(self): LOG.debug(u'Loading storage driver') if self.conf.pooling: LOG.debug(u'Storage pooling enabled') storage_driver = pooling.DataDriver(self.conf, self.cache, self.control) if self.conf.profiler.enabled: storage_driver = profiler.trace_cls("pooling_data_" "driver")(storage_driver) else: storage_driver = storage_utils.load_storage_driver( self.conf, self.cache, control_driver=self.control) LOG.debug(u'Loading storage pipeline') return pipeline.DataDriver(self.conf, storage_driver, self.control)
def __init__(self, host=None, binary=None, topic=None, manager=None, rpc_api_version=None): super(RpcService, self).__init__() self.host = host or CONF.host self.binary = binary or os.path.basename(inspect.stack()[-1][1]) self.topic = topic or self.binary.rpartition('trove-')[2] _manager = importutils.import_object(manager) self.manager_impl = profiler.trace_cls("rpc")(_manager) self.report_interval = CONF.report_interval self.rpc_api_version = rpc_api_version or \ self.manager_impl.RPC_API_VERSION profile.setup_profiler(self.binary, self.host)
def _get_builtin_entry_points(resource_name, storage, control_driver, conf): # Load builtin stages builtin_entry_points = [] # NOTE(flaper87): The namespace will look like: # `zaqar.storage.$STORAGE.driver.stages`. For now, # the builtin stages are bound to a single store and # are not applied to every store. namespace = '%s.%s.stages' % (storage.__module__, resource_name) extensions = extension.ExtensionManager( namespace, invoke_on_load=True, invoke_args=[storage, control_driver]) if len(extensions.extensions) == 0: return [] for ext in extensions.extensions: builtin_entry_points.append(ext.obj) if conf.profiler.enabled and conf.profiler.trace_message_store: return (profiler.trace_cls("stages_controller")(builtin_entry_points)) return builtin_entry_points
def _get_builtin_entry_points(resource_name, storage, control_driver, conf): # Load builtin stages builtin_entry_points = [] # NOTE(flaper87): The namespace will look like: # `zaqar.storage.$STORAGE.driver.stages`. For now, # the builtin stages are bound to a single store and # are not applied to every store. namespace = '%s.%s.stages' % (storage.__module__, resource_name) extensions = extension.ExtensionManager(namespace, invoke_on_load=True, invoke_args=[storage, control_driver]) if len(extensions.extensions) == 0: return [] for ext in extensions.extensions: builtin_entry_points.append(ext.obj) if conf.profiler.enabled and conf.profiler.trace_message_store: return (profiler.trace_cls("stages_controller") (builtin_entry_points)) return builtin_entry_points
def queue_controller(self): controller = QueueController(self._pool_catalog) if self.conf.profiler.enabled: return profiler.trace_cls("pooling_queue_controller")(controller) else: return controller
def claim_controller(self): controller = ClaimController(self._pool_catalog) if self.conf.profiler.enabled: return profiler.trace_cls("pooling_claim_controller")(controller) else: return controller
def topic_controller(self): controller = TopicController(self._pool_catalog) if self.conf.profiler.enabled: return profiler.trace_cls("pooling_topic_controller")(controller) else: return controller
def message_controller(self): controller = MessageController(self._pool_catalog) if self.conf.profiler.enabled: return profiler.trace_cls("pooling_message_controller")(controller) else: return controller
def decorator(cls): if CONF.profiler.enabled: trace_decorator = profiler.trace_cls(name, kwargs) return trace_decorator(cls) return cls