def from_user_conf(cls, target:Target, consumer:Consumer, user_conf:FtraceConf=None) -> 'ExekallFtraceCollector': base_conf = cls._get_consumer_conf(consumer) consumer_cls = get_method_class(consumer) merged_src = 'user+{}'.format(consumer_cls.__qualname__) return super().from_user_conf( target, base_conf, user_conf, merged_src=merged_src )
def _get_consumer_conf(consumer): attr = 'ftrace_conf' consumer_cls = get_method_class(consumer) conf = getattr(consumer_cls, attr, FtraceConf()) # This is not strictly speaking forbidden but in the current situation, # there is no legitimate use case where it could happen, and it is very # likely that it comes from a design issue in the class if not conf['events'] and issubclass(consumer_cls, TestBundle): raise ValueError( f"Empty events list in {consumer_cls.__qualname__}.{attr}") return conf