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.
- Variables:
_rules (
TrackingRules) – Manager for tracking analysis rules_trace (
TrackerTrace) – Currently loaded trace data for analysis
Examples
>>> 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.
- Parameters:
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.
- Returns:
Analysis result, format depends on the rule used
- Return type:
Any- Raises:
FileNotFoundError – If the specified trace file does not exist
ValueError – If the specified rule_id is not registered
Notes
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.
- Returns:
List of registered rule IDs
- Return type:
List[str]
Examples
>>> 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.
- Parameters:
rule (
TrackingRule) – Rule instance to register
Notes
Registered rules become available for analyze_file()
Rules must have unique rule_id values