liangzimixin 0.3.61 → 0.3.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +28 -5
- package/dist/setup-entry.cjs +28 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17556,7 +17556,7 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
17556
17556
|
},
|
|
17557
17557
|
metrics: {
|
|
17558
17558
|
enabled: true,
|
|
17559
|
-
logIntervalMs:
|
|
17559
|
+
logIntervalMs: 6e4
|
|
17560
17560
|
}
|
|
17561
17561
|
};
|
|
17562
17562
|
function buildPluginConfig(accountConfig, internalOverrides) {
|
|
@@ -17992,17 +17992,40 @@ var Metrics = class {
|
|
|
17992
17992
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
17993
17993
|
};
|
|
17994
17994
|
}
|
|
17995
|
+
/** 上次输出时的计数器快照 — 用于增量比对 */
|
|
17996
|
+
lastCounterSnapshot = /* @__PURE__ */ new Map();
|
|
17997
|
+
/** 上次输出时的直方图采样计数 — 用于增量比对 */
|
|
17998
|
+
lastHistogramCount = /* @__PURE__ */ new Map();
|
|
17995
17999
|
/**
|
|
17996
|
-
*
|
|
17997
|
-
*
|
|
18000
|
+
* 启动定期日志输出 (增量模式)。
|
|
18001
|
+
* 仅在有新数据变化时才输出,空闲期间静默。
|
|
18002
|
+
* @param intervalMs - 检查间隔 (ms),默认 60000 (1 分钟)
|
|
17998
18003
|
*/
|
|
17999
18004
|
startPeriodicLog(intervalMs = 6e4) {
|
|
18000
18005
|
if (this.started) return;
|
|
18001
18006
|
this.started = true;
|
|
18002
18007
|
this.logTimer = setInterval(() => {
|
|
18008
|
+
let hasChanges = false;
|
|
18009
|
+
for (const [name, count] of this.counters) {
|
|
18010
|
+
if ((this.lastCounterSnapshot.get(name) ?? 0) !== count) {
|
|
18011
|
+
hasChanges = true;
|
|
18012
|
+
break;
|
|
18013
|
+
}
|
|
18014
|
+
}
|
|
18015
|
+
if (!hasChanges) {
|
|
18016
|
+
for (const [name, hist] of this.histograms) {
|
|
18017
|
+
if ((this.lastHistogramCount.get(name) ?? 0) !== hist.count) {
|
|
18018
|
+
hasChanges = true;
|
|
18019
|
+
break;
|
|
18020
|
+
}
|
|
18021
|
+
}
|
|
18022
|
+
}
|
|
18023
|
+
if (!hasChanges) return;
|
|
18003
18024
|
const snap = this.snapshot();
|
|
18004
|
-
|
|
18005
|
-
|
|
18025
|
+
log3.info("\u{1F4CA} metrics snapshot", snap);
|
|
18026
|
+
this.lastCounterSnapshot = new Map(this.counters);
|
|
18027
|
+
for (const [name, hist] of this.histograms) {
|
|
18028
|
+
this.lastHistogramCount.set(name, hist.count);
|
|
18006
18029
|
}
|
|
18007
18030
|
}, intervalMs);
|
|
18008
18031
|
if (this.logTimer && typeof this.logTimer === "object" && "unref" in this.logTimer) {
|
package/dist/setup-entry.cjs
CHANGED
|
@@ -4065,17 +4065,40 @@ var Metrics = class {
|
|
|
4065
4065
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
4066
4066
|
};
|
|
4067
4067
|
}
|
|
4068
|
+
/** 上次输出时的计数器快照 — 用于增量比对 */
|
|
4069
|
+
lastCounterSnapshot = /* @__PURE__ */ new Map();
|
|
4070
|
+
/** 上次输出时的直方图采样计数 — 用于增量比对 */
|
|
4071
|
+
lastHistogramCount = /* @__PURE__ */ new Map();
|
|
4068
4072
|
/**
|
|
4069
|
-
*
|
|
4070
|
-
*
|
|
4073
|
+
* 启动定期日志输出 (增量模式)。
|
|
4074
|
+
* 仅在有新数据变化时才输出,空闲期间静默。
|
|
4075
|
+
* @param intervalMs - 检查间隔 (ms),默认 60000 (1 分钟)
|
|
4071
4076
|
*/
|
|
4072
4077
|
startPeriodicLog(intervalMs = 6e4) {
|
|
4073
4078
|
if (this.started) return;
|
|
4074
4079
|
this.started = true;
|
|
4075
4080
|
this.logTimer = setInterval(() => {
|
|
4081
|
+
let hasChanges = false;
|
|
4082
|
+
for (const [name, count] of this.counters) {
|
|
4083
|
+
if ((this.lastCounterSnapshot.get(name) ?? 0) !== count) {
|
|
4084
|
+
hasChanges = true;
|
|
4085
|
+
break;
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
if (!hasChanges) {
|
|
4089
|
+
for (const [name, hist] of this.histograms) {
|
|
4090
|
+
if ((this.lastHistogramCount.get(name) ?? 0) !== hist.count) {
|
|
4091
|
+
hasChanges = true;
|
|
4092
|
+
break;
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
if (!hasChanges) return;
|
|
4076
4097
|
const snap = this.snapshot();
|
|
4077
|
-
|
|
4078
|
-
|
|
4098
|
+
log3.info("\u{1F4CA} metrics snapshot", snap);
|
|
4099
|
+
this.lastCounterSnapshot = new Map(this.counters);
|
|
4100
|
+
for (const [name, hist] of this.histograms) {
|
|
4101
|
+
this.lastHistogramCount.set(name, hist.count);
|
|
4079
4102
|
}
|
|
4080
4103
|
}, intervalMs);
|
|
4081
4104
|
if (this.logTimer && typeof this.logTimer === "object" && "unref" in this.logTimer) {
|
|
@@ -18680,7 +18703,7 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
18680
18703
|
},
|
|
18681
18704
|
metrics: {
|
|
18682
18705
|
enabled: true,
|
|
18683
|
-
logIntervalMs:
|
|
18706
|
+
logIntervalMs: 6e4
|
|
18684
18707
|
}
|
|
18685
18708
|
};
|
|
18686
18709
|
function buildPluginConfig(accountConfig, internalOverrides) {
|