qpanda3_runtime.toolbox.tracker.trace_analyzer#
Classes#
Trace data analyzer for rule-based analysis of tracking traces. |
Module Contents#
- class qpanda3_runtime.toolbox.tracker.trace_analyzer.TraceAnalyzer#
Trace data analyzer for rule-based analysis of tracking traces.
This class provides analysis capabilities for tracking trace files using registered analysis rules. It supports automatic rule selection and manual rule specification.
- 变量:
_rules (
TrackingRules) -- Manager for tracking analysis rules_trace (
TrackerTrace) -- Currently loaded trace data for analysis
示例
>>> analyzer = TraceAnalyzer() >>> result = analyzer.analyze_file("trace.jsonl") >>> available_rules = analyzer.get_available_rules()
- analyze_file(file_path: str, rule_id: str = None) Any#
Analyze historical trace file using specified or automatic rule.
- 参数:
file_path (
str) -- Path to the trace file to analyzerule_id (
str, optional) -- ID of the rule to use for analysis. If None, automatic rule selection is performed based on default rule.
- 返回:
Analysis result, format depends on the rule used
- 返回类型:
Any- 抛出:
FileNotFoundError -- If the specified trace file does not exist
ValueError -- If the specified rule_id is not registered
备注
Trace files are loaded with history records enabled
Analysis results are printed to console for debugging
- get_available_rules() List[str]#
Get list of available analysis rule IDs.
- 返回:
List of registered rule IDs
- 返回类型:
List[str]
示例
>>> analyzer = TraceAnalyzer() >>> rules = analyzer.get_available_rules() >>> print(rules) ['default', 'qtask_failure']
- register_rule(rule: qpanda3_runtime.toolbox.tracker.tracking_rule.TrackingRule) None#
Register a new analysis rule.
- 参数:
rule (
TrackingRule) -- Rule instance to register
备注
Registered rules become available for analyze_file()
Rules must have unique rule_id values