Skip to main content

Crate exception_collector

Crate exception_collector 

Source
Expand description

Exception Collector — 全项目组异常收集系统。

自动捕获 panic、error 日志和 Result::Err,根据用户是否参与「共建计划」 走两条上报路径:

  • 共建用户(已安装 gh CLI):LLM 语义去重 → 自动创建 GitHub Issue
  • 普通用户(无 gh):本地签名去重 → 批量上传自研收集平台

§集成方式

每个组件在启动入口调用 install() 注册 panic hook 和 tracing layer:

use exception_collector::{CollectorConfig, install};

let config = CollectorConfig::from_file("repo-map.toml")?;
install(config, "component-name".into());

Structs§

AggregatedException
缓冲区内按签名聚合的异常。
ClassificationResult
The LLM’s decision for a single exception record.
CollectorConfig
收集器配置。
CustomPlatformReporter
Reports exceptions by sending a POST request to a custom platform endpoint.
DedupEngine
Local signature deduplication engine.
ExceptionBatch
上报批次。
ExceptionBuffer
In-memory and SQLite-backed buffer for exception aggregation.
ExceptionRecord
单条异常记录。
ExistingIssueData
Data about an existing open GitHub issue (for dedup comparison).
GitHubReporter
Reports exceptions by calling the gh CLI.
LlmClassifier
Classifies exception batches using an LLM channel.
PipelineRunner
Orchestrates the exception reporting pipeline.
RetryPolicy
指数退避重试策略。

Enums§

BatchStatus
批次上报状态。
ClassificationAction
Action determined by LLM classification.
CollectorError
收集器错误类型。
ExceptionKind
异常来源类型。
ReportResult
上报结果。
ReportTarget
上报目标。

Traits§

ExceptionReporter
异常上报器 trait。
LlmChannel
Abstract LLM channel for classification requests.

Functions§

collect_result_err
Manually capture a Result::Err into the buffer.
collect_unreported
Scan all *.db files under the shared exceptions directory and return any unreported exception records across all components.
compute_signature
Compute a SHA256 deduplication signature for an exception record.
exceptions_dir
Resolve the shared exceptions directory.
with_retry
对异步操作执行指数退避重试。

Type Aliases§

CollectorResult
收集器结果类型别名。