ai-otel-setup 1.0.5 → 1.0.6

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/cli.js CHANGED
@@ -475,7 +475,7 @@ function main() {
475
475
  };
476
476
 
477
477
  // UserPromptSubmit 兜底 hook:复用同一脚本,由 stdin.hook_event_name 在脚本内部
478
- // 分流。客户端做 5 分钟节流,服务端见 entry 已存在则仅补空。用于救 SessionStart
478
+ // 分流。客户端做 2 分钟节流,服务端见 entry 已存在则仅补空。用于救 SessionStart
479
479
  // 因网络/超时丢失的场景(线上观测约 60% 事件因此空 git/hostname)。
480
480
  const promptHookEntry = {
481
481
  matcher: "*",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-otel-setup",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "One-shot installer for AI CLI OpenTelemetry forwarding. Writes Claude Code, Codex CLI, and Gemini CLI telemetry config in a single npx command.",
5
5
  "bin": {
6
6
  "ai-otel-setup": "cli.js",
@@ -20,8 +20,8 @@
20
20
  *
21
21
  * 节流(仅对 UserPromptSubmit):
22
22
  * - 在 ~/.claude/cc-otel-state/sent-<sid>.flag 写 marker
23
- * - 5 分钟内同 sid 跳过 OTLP 上报,避免高频敲键狂发
24
- * - 5 分钟后过期允许重试,给丢包/瞬时故障留救命窗口
23
+ * - 2 分钟内同 sid 跳过 OTLP 上报,避免高频敲键狂发
24
+ * - 2 分钟后过期允许重试,给丢包/瞬时故障留救命窗口
25
25
  */
26
26
 
27
27
  "use strict";
@@ -34,8 +34,8 @@ const http = require("http");
34
34
  const https = require("https");
35
35
  const { URL } = require("url");
36
36
 
37
- // UserPromptSubmit 节流窗口:5 分钟
38
- const PROMPT_THROTTLE_MS = 5 * 60 * 1000;
37
+ // UserPromptSubmit 节流窗口:2 分钟
38
+ const PROMPT_THROTTLE_MS = 2 * 60 * 1000;
39
39
 
40
40
  // -------- 环境变量读取 ----------
41
41
 
@@ -120,7 +120,7 @@ function safeGit(args) {
120
120
  // CC 在 stdin 里告诉脚本是哪个 hook 触发的;UserPromptSubmit 走"兜底"分支
121
121
  const isPromptFallback = input.hook_event_name === "UserPromptSubmit";
122
122
 
123
- // 兜底路径节流:sid 维度 5 分钟最多一次(marker 文件 mtime 判断)。
123
+ // 兜底路径节流:sid 维度 2 分钟最多一次(marker 文件 mtime 判断)。
124
124
  // 失败重试窗口同时由此控制:marker 过期后允许下次 prompt 再发一次。
125
125
  const stateDir = path.join(os.homedir(), ".claude", "cc-otel-state");
126
126
  const markerPath = sessionId ? path.join(stateDir, `sent-${sessionId}.flag`) : null;
@@ -217,8 +217,8 @@ function safeGit(args) {
217
217
  req.on("timeout", () => { req.destroy(); done(); });
218
218
 
219
219
  // 在真正发包前 touch marker 文件——把"已尝试上报"持久化下来,
220
- // 让后续 5 分钟内的 UserPromptSubmit 跳过重复 POST。失败也照写,
221
- // 因为 5 分钟后 marker 会过期允许重试,不会永久卡住。
220
+ // 让后续 2 分钟内的 UserPromptSubmit 跳过重复 POST。失败也照写,
221
+ // 因为 2 分钟后 marker 会过期允许重试,不会永久卡住。
222
222
  if (markerPath) {
223
223
  try {
224
224
  fs.mkdirSync(stateDir, { recursive: true });
@@ -5,8 +5,8 @@
5
5
  "OTEL_LOGS_EXPORTER": "otlp",
6
6
  "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
7
7
  "OTEL_EXPORTER_OTLP_ENDPOINT": "PLACEHOLDER_ENDPOINT",
8
- "OTEL_LOGS_EXPORT_INTERVAL": "300000",
9
- "OTEL_METRIC_EXPORT_INTERVAL": "600000",
8
+ "OTEL_LOGS_EXPORT_INTERVAL": "120000",
9
+ "OTEL_METRIC_EXPORT_INTERVAL": "300000",
10
10
  "OTEL_METRICS_INCLUDE_VERSION": "true",
11
11
  "OTEL_LOG_USER_PROMPTS": "0",
12
12
  "OTEL_LOG_TOOL_DETAILS": "1",