mirror of
https://github.com/woodchen-ink/proxy-go.git
synced 2025-07-18 00:21:56 +08:00
移除对基本指标的持久化,仅保留状态码和引用来源统计的持久化,简化指标存储逻辑。
This commit is contained in:
parent
cc677bcf72
commit
4d9162f5e8
@ -102,9 +102,6 @@ func (ms *MetricsStorage) SaveMetrics() error {
|
||||
// 获取当前指标数据
|
||||
stats := ms.collector.GetStats()
|
||||
|
||||
// 不再持久化 basicMetrics(metrics.json),只在内存中维护
|
||||
// 只持久化累计型数据
|
||||
|
||||
// 保存状态码统计
|
||||
if err := saveJSONToFile(ms.statusCodeFile, stats["status_code_stats"]); err != nil {
|
||||
return fmt.Errorf("保存状态码统计失败: %v", err)
|
||||
@ -125,10 +122,6 @@ func (ms *MetricsStorage) SaveMetrics() error {
|
||||
}
|
||||
}
|
||||
|
||||
ms.mutex.Lock()
|
||||
ms.lastSaveTime = time.Now()
|
||||
ms.mutex.Unlock()
|
||||
|
||||
// 强制进行一次GC
|
||||
runtime.GC()
|
||||
|
||||
@ -233,11 +226,6 @@ func (ms *MetricsStorage) LoadMetrics() error {
|
||||
log.Printf("[MetricsStorage] 加载了延迟分布数据")
|
||||
}
|
||||
}
|
||||
|
||||
ms.mutex.Lock()
|
||||
// 不再恢复 lastSaveTime(metrics.json 里才有)
|
||||
ms.mutex.Unlock()
|
||||
|
||||
// 强制进行一次GC
|
||||
runtime.GC()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user