dsh-local-telemetry 0.1.0 → 0.1.1
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/CHANGELOG.md +8 -1
- package/DSH-TELEMETRY-/345/274/200/345/217/221/350/256/241/345/210/222.md +153 -154
- package/PUBLISHING.md +3 -3
- package/README.md +19 -1
- package/bin/telemetry.mjs +1 -1
- package/docs/screenshots/dashboard.png +0 -0
- package/docs/screenshots/tools-plugins.png +0 -0
- package/docs/screenshots/trace-fallback.png +0 -0
- package/package.json +6 -1
- package/plugin/index.js +1 -0
- package/src/aggregate.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/) 约定。
|
|
4
4
|
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
## 0.1.1 - 2026-09-06
|
|
8
|
+
|
|
9
|
+
- 新增固定 `@deepseek-ai/dsh@0.1.2-rc.1` 的 `npm run test:compat` 门禁及 Windows/Ubuntu Node 22.19 CI,覆盖隔离 profile 的 add、配置 dump 和有限时长启动。
|
|
10
|
+
- 文档明确三层兼容性:JSONL/纯 CLI Node >=18、SQLite Node >=22.5、最新 DSH 宿主验证 Node >=22.19。
|
|
11
|
+
- 修复插件入口遗漏 `skills` 服务注入声明的问题,确保 DSH 启动时实际注册 telemetry runbook,而不是静默降级。
|
|
12
|
+
|
|
5
13
|
## 0.1.0 - 2026-09-02
|
|
6
14
|
|
|
7
15
|
- 首个公开发布版本。
|
|
@@ -79,4 +87,3 @@
|
|
|
79
87
|
- Phase 2 验收:摘要可由原始事件重算。
|
|
80
88
|
|
|
81
89
|
- Phase 5 验收:JSONL 与 SQLite 对同一事件集产生一致聚合结果。
|
|
82
|
-
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
|
|
86
86
|
- **宿主 Hook 能力**:DSH Harness 的生命周期 Hook(`request.started` / `model.completed` / …)当前无法确认其真实暴露面。按计划 §2 的降级路径,已实现独立事件记录器与显式适配器接口(`src/adapter.mjs`),只接入已确认存在的生命周期事件。缺失指标返回 `null` / `unavailable`,不伪造。
|
|
87
87
|
|
|
88
|
-
- **技术栈选择**:零构建 ESM 模块;JSONL
|
|
88
|
+
- **技术栈选择**:零构建 ESM 模块;JSONL 和纯 CLI 能力独立支持 Node ≥18;SQLite 后端使用 Node ≥22.5 内置 `node:sqlite`(零 npm 依赖);作为 DSH 0.1.2-rc.1 宿主统一按 Node ≥22.19 验证。
|
|
89
89
|
|
|
90
90
|
- **事件契约**:12 种生命周期事件(`request.started` / `model.completed` / `tool.completed` 等)已定义;失败/超时/取消通过 `result.status` 表达,无独立 `tool.failed` 事件名。`src/schema.mjs` 提供校验与序列化,未知指标为 null 不补 0。
|
|
91
91
|
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
|
|
124
124
|
### 0.5 与参考项目对齐
|
|
125
125
|
|
|
126
|
-
- 与 `dsh-repo-scanner` 对齐:package.json `dsh.bundle.patch` + cordis.patch.yml `- insert:` 格式 + FileSystemSkillProvider
|
|
126
|
+
- 与 `dsh-repo-scanner` 对齐:package.json `dsh.bundle.patch` + cordis.patch.yml `- insert:` 格式 + FileSystemSkillProvider 模式;Node 18/20/22 仅为独立脚本回归,另有 DSH 0.1.2-rc.1 / Node 22.19 compat 门禁。
|
|
127
127
|
|
|
128
128
|
- 测试框架:使用 `node:test`;契约测试、隐私测试、性能测试、跨平台测试覆盖。
|
|
129
129
|
|
|
@@ -208,17 +208,17 @@ Make Harness behavior measurable without collecting sensitive conversation conte
|
|
|
208
208
|
在实现前必须确认 DSH Harness 实际暴露的生命周期接口。目标事件:
|
|
209
209
|
|
|
210
210
|
```text
|
|
211
|
-
request.started
|
|
212
|
-
request.context
|
|
213
|
-
model.requested
|
|
214
|
-
model.first_token
|
|
215
|
-
model.completed
|
|
216
|
-
model.failed
|
|
217
|
-
tool.started
|
|
218
|
-
tool.completed
|
|
219
|
-
plugin.started
|
|
220
|
-
plugin.completed
|
|
221
|
-
request.completed
|
|
211
|
+
request.started
|
|
212
|
+
request.context
|
|
213
|
+
model.requested
|
|
214
|
+
model.first_token
|
|
215
|
+
model.completed
|
|
216
|
+
model.failed
|
|
217
|
+
tool.started
|
|
218
|
+
tool.completed
|
|
219
|
+
plugin.started
|
|
220
|
+
plugin.completed
|
|
221
|
+
request.completed
|
|
222
222
|
request.cancelled
|
|
223
223
|
```
|
|
224
224
|
|
|
@@ -232,9 +232,9 @@ request.cancelled
|
|
|
232
232
|
建议适配接口:
|
|
233
233
|
|
|
234
234
|
```ts
|
|
235
|
-
interface HarnessTelemetryAdapter {
|
|
236
|
-
on(event: string, handler: (event: TelemetryEvent) => void): () => void;
|
|
237
|
-
getCapabilities(): TelemetryCapabilities;
|
|
235
|
+
interface HarnessTelemetryAdapter {
|
|
236
|
+
on(event: string, handler: (event: TelemetryEvent) => void): () => void;
|
|
237
|
+
getCapabilities(): TelemetryCapabilities;
|
|
238
238
|
}
|
|
239
239
|
```
|
|
240
240
|
|
|
@@ -257,49 +257,49 @@ interface HarnessTelemetryAdapter {
|
|
|
257
257
|
一个请求的结构:
|
|
258
258
|
|
|
259
259
|
```text
|
|
260
|
-
request span
|
|
261
|
-
├── plugin span
|
|
262
|
-
├── model attempt span
|
|
263
|
-
│ ├── tool span
|
|
264
|
-
│ └── tool span
|
|
260
|
+
request span
|
|
261
|
+
├── plugin span
|
|
262
|
+
├── model attempt span
|
|
263
|
+
│ ├── tool span
|
|
264
|
+
│ └── tool span
|
|
265
265
|
└── retry model attempt span
|
|
266
266
|
```
|
|
267
267
|
|
|
268
268
|
### 3.2 最小事件结构
|
|
269
269
|
|
|
270
270
|
```json
|
|
271
|
-
{
|
|
272
|
-
"schema_version": "1.0",
|
|
273
|
-
"event": "model.completed",
|
|
274
|
-
"event_id": "evt-001",
|
|
275
|
-
"trace_id": "trace-001",
|
|
276
|
-
"span_id": "span-003",
|
|
277
|
-
"parent_id": "span-001",
|
|
278
|
-
"timestamp": "2026-08-23T12:00:00.000Z",
|
|
279
|
-
"duration_ms": 8420,
|
|
280
|
-
"session": {
|
|
281
|
-
"profile": "web",
|
|
282
|
-
"environment": "local"
|
|
283
|
-
},
|
|
284
|
-
"model": {
|
|
285
|
-
"provider": "deepseek",
|
|
286
|
-
"name": "deepseek-chat",
|
|
287
|
-
"request_type": "chat"
|
|
288
|
-
},
|
|
289
|
-
"usage": {
|
|
290
|
-
"input_tokens": 4200,
|
|
291
|
-
"output_tokens": 860,
|
|
292
|
-
"cached_input_tokens": 0,
|
|
293
|
-
"reasoning_tokens": null
|
|
294
|
-
},
|
|
295
|
-
"result": {
|
|
296
|
-
"status": "success",
|
|
297
|
-
"finish_reason": "stop"
|
|
298
|
-
},
|
|
299
|
-
"privacy": {
|
|
300
|
-
"content_captured": false,
|
|
301
|
-
"redactions": 0
|
|
302
|
-
}
|
|
271
|
+
{
|
|
272
|
+
"schema_version": "1.0",
|
|
273
|
+
"event": "model.completed",
|
|
274
|
+
"event_id": "evt-001",
|
|
275
|
+
"trace_id": "trace-001",
|
|
276
|
+
"span_id": "span-003",
|
|
277
|
+
"parent_id": "span-001",
|
|
278
|
+
"timestamp": "2026-08-23T12:00:00.000Z",
|
|
279
|
+
"duration_ms": 8420,
|
|
280
|
+
"session": {
|
|
281
|
+
"profile": "web",
|
|
282
|
+
"environment": "local"
|
|
283
|
+
},
|
|
284
|
+
"model": {
|
|
285
|
+
"provider": "deepseek",
|
|
286
|
+
"name": "deepseek-chat",
|
|
287
|
+
"request_type": "chat"
|
|
288
|
+
},
|
|
289
|
+
"usage": {
|
|
290
|
+
"input_tokens": 4200,
|
|
291
|
+
"output_tokens": 860,
|
|
292
|
+
"cached_input_tokens": 0,
|
|
293
|
+
"reasoning_tokens": null
|
|
294
|
+
},
|
|
295
|
+
"result": {
|
|
296
|
+
"status": "success",
|
|
297
|
+
"finish_reason": "stop"
|
|
298
|
+
},
|
|
299
|
+
"privacy": {
|
|
300
|
+
"content_captured": false,
|
|
301
|
+
"redactions": 0
|
|
302
|
+
}
|
|
303
303
|
}
|
|
304
304
|
```
|
|
305
305
|
|
|
@@ -388,16 +388,16 @@ request span
|
|
|
388
388
|
价格不能硬编码在业务逻辑中,使用版本化配置:
|
|
389
389
|
|
|
390
390
|
```json
|
|
391
|
-
{
|
|
392
|
-
"currency": "USD",
|
|
393
|
-
"effective_at": "2026-08-23T00:00:00Z",
|
|
394
|
-
"models": {
|
|
395
|
-
"deepseek-chat": {
|
|
396
|
-
"input_per_million": 0.27,
|
|
397
|
-
"cached_input_per_million": 0.07,
|
|
398
|
-
"output_per_million": 1.10
|
|
399
|
-
}
|
|
400
|
-
}
|
|
391
|
+
{
|
|
392
|
+
"currency": "USD",
|
|
393
|
+
"effective_at": "2026-08-23T00:00:00Z",
|
|
394
|
+
"models": {
|
|
395
|
+
"deepseek-chat": {
|
|
396
|
+
"input_per_million": 0.27,
|
|
397
|
+
"cached_input_per_million": 0.07,
|
|
398
|
+
"output_per_million": 1.10
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
401
|
}
|
|
402
402
|
```
|
|
403
403
|
|
|
@@ -406,8 +406,8 @@ request span
|
|
|
406
406
|
只有在模型、Token 和价格均可确认时才计算:
|
|
407
407
|
|
|
408
408
|
```text
|
|
409
|
-
cost = input_tokens × input_price
|
|
410
|
-
+ cached_input_tokens × cached_input_price
|
|
409
|
+
cost = input_tokens × input_price
|
|
410
|
+
+ cached_input_tokens × cached_input_price
|
|
411
411
|
+ output_tokens × output_price
|
|
412
412
|
```
|
|
413
413
|
|
|
@@ -456,12 +456,12 @@ cost = input_tokens × input_price
|
|
|
456
456
|
脱敏记录只保留数量和规则名,不保存原文:
|
|
457
457
|
|
|
458
458
|
```json
|
|
459
|
-
{
|
|
460
|
-
"privacy": {
|
|
461
|
-
"content_captured": false,
|
|
462
|
-
"redactions": 2,
|
|
463
|
-
"rules": ["authorization", "api_key"]
|
|
464
|
-
}
|
|
459
|
+
{
|
|
460
|
+
"privacy": {
|
|
461
|
+
"content_captured": false,
|
|
462
|
+
"redactions": 2,
|
|
463
|
+
"rules": ["authorization", "api_key"]
|
|
464
|
+
}
|
|
465
465
|
}
|
|
466
466
|
```
|
|
467
467
|
|
|
@@ -500,11 +500,11 @@ cost = input_tokens × input_price
|
|
|
500
500
|
默认配置建议:
|
|
501
501
|
|
|
502
502
|
```text
|
|
503
|
-
单事件内存:不超过 64 KB
|
|
504
|
-
内存队列:不超过 1000 条
|
|
505
|
-
批量写入:100 条或 1 秒触发
|
|
506
|
-
单事件处理:不超过 5 ms
|
|
507
|
-
本地日志轮转:100 MB
|
|
503
|
+
单事件内存:不超过 64 KB
|
|
504
|
+
内存队列:不超过 1000 条
|
|
505
|
+
批量写入:100 条或 1 秒触发
|
|
506
|
+
单事件处理:不超过 5 ms
|
|
507
|
+
本地日志轮转:100 MB
|
|
508
508
|
默认保留:7 天
|
|
509
509
|
```
|
|
510
510
|
|
|
@@ -537,10 +537,10 @@ cost = input_tokens × input_price
|
|
|
537
537
|
CLI:
|
|
538
538
|
|
|
539
539
|
```bash
|
|
540
|
-
node scripts/telemetry.mjs --status
|
|
541
|
-
node scripts/telemetry.mjs --summary --since 1h
|
|
542
|
-
node scripts/telemetry.mjs --trace <trace_id>
|
|
543
|
-
node scripts/telemetry.mjs --export summary.json --since 7d
|
|
540
|
+
node scripts/telemetry.mjs --status
|
|
541
|
+
node scripts/telemetry.mjs --summary --since 1h
|
|
542
|
+
node scripts/telemetry.mjs --trace <trace_id>
|
|
543
|
+
node scripts/telemetry.mjs --export summary.json --since 7d
|
|
544
544
|
node scripts/telemetry.mjs --purge --before 30d
|
|
545
545
|
```
|
|
546
546
|
|
|
@@ -561,10 +561,10 @@ node scripts/telemetry.mjs --purge --before 30d
|
|
|
561
561
|
核心接口:
|
|
562
562
|
|
|
563
563
|
```ts
|
|
564
|
-
interface TelemetrySink {
|
|
565
|
-
write(event: TelemetryEvent): Promise<void>;
|
|
566
|
-
flush(): Promise<void>;
|
|
567
|
-
close(): Promise<void>;
|
|
564
|
+
interface TelemetrySink {
|
|
565
|
+
write(event: TelemetryEvent): Promise<void>;
|
|
566
|
+
flush(): Promise<void>;
|
|
567
|
+
close(): Promise<void>;
|
|
568
568
|
}
|
|
569
569
|
```
|
|
570
570
|
|
|
@@ -577,15 +577,15 @@ JSONL 和 SQLite 必须共享同一个事件 schema,不能为不同后端发
|
|
|
577
577
|
示例:
|
|
578
578
|
|
|
579
579
|
```text
|
|
580
|
-
Telemetry summary: last 1h
|
|
581
|
-
Requests 42
|
|
582
|
-
Success 39 (92.9%)
|
|
583
|
-
Errors 3
|
|
584
|
-
P95 latency 12.4s
|
|
585
|
-
Input tokens 182,300
|
|
586
|
-
Output tokens 41,820
|
|
587
|
-
Estimated cost $0.094
|
|
588
|
-
Tool calls 217
|
|
580
|
+
Telemetry summary: last 1h
|
|
581
|
+
Requests 42
|
|
582
|
+
Success 39 (92.9%)
|
|
583
|
+
Errors 3
|
|
584
|
+
P95 latency 12.4s
|
|
585
|
+
Input tokens 182,300
|
|
586
|
+
Output tokens 41,820
|
|
587
|
+
Estimated cost $0.094
|
|
588
|
+
Tool calls 217
|
|
589
589
|
Dropped events 0
|
|
590
590
|
```
|
|
591
591
|
|
|
@@ -596,28 +596,28 @@ Dropped events 0
|
|
|
596
596
|
可选输出 `TELEMETRY-REPORT.md`:
|
|
597
597
|
|
|
598
598
|
```markdown
|
|
599
|
-
# Harness 遥测报告
|
|
600
|
-
|
|
601
|
-
## 1. 时间范围与数据完整性
|
|
602
|
-
|
|
603
|
-
## 2. 请求和错误概览
|
|
604
|
-
|
|
605
|
-
## 3. 延迟分布
|
|
606
|
-
|
|
607
|
-
## 4. Token 与成本
|
|
608
|
-
|
|
609
|
-
## 5. 模型比较
|
|
610
|
-
|
|
611
|
-
## 6. 工具与插件耗时
|
|
612
|
-
|
|
613
|
-
## 7. 慢请求和失败请求
|
|
614
|
-
|
|
615
|
-
## 8. 缓存、重试和回退
|
|
616
|
-
|
|
617
|
-
## 9. 数据隐私与丢弃事件
|
|
618
|
-
|
|
619
|
-
## 附录
|
|
620
|
-
|
|
599
|
+
# Harness 遥测报告
|
|
600
|
+
|
|
601
|
+
## 1. 时间范围与数据完整性
|
|
602
|
+
|
|
603
|
+
## 2. 请求和错误概览
|
|
604
|
+
|
|
605
|
+
## 3. 延迟分布
|
|
606
|
+
|
|
607
|
+
## 4. Token 与成本
|
|
608
|
+
|
|
609
|
+
## 5. 模型比较
|
|
610
|
+
|
|
611
|
+
## 6. 工具与插件耗时
|
|
612
|
+
|
|
613
|
+
## 7. 慢请求和失败请求
|
|
614
|
+
|
|
615
|
+
## 8. 缓存、重试和回退
|
|
616
|
+
|
|
617
|
+
## 9. 数据隐私与丢弃事件
|
|
618
|
+
|
|
619
|
+
## 附录
|
|
620
|
+
|
|
621
621
|
schema、价格配置、采样配置和生成命令。
|
|
622
622
|
```
|
|
623
623
|
|
|
@@ -642,31 +642,31 @@ schema、价格配置、采样配置和生成命令。
|
|
|
642
642
|
CLI:
|
|
643
643
|
|
|
644
644
|
```bash
|
|
645
|
-
node scripts/telemetry.mjs --status
|
|
646
|
-
node scripts/telemetry.mjs --summary --since 24h --group-by model
|
|
647
|
-
node scripts/telemetry.mjs --trace <trace_id>
|
|
648
|
-
node scripts/telemetry.mjs --export report.json --since 7d
|
|
649
|
-
node scripts/telemetry.mjs --config telemetry.json
|
|
645
|
+
node scripts/telemetry.mjs --status
|
|
646
|
+
node scripts/telemetry.mjs --summary --since 24h --group-by model
|
|
647
|
+
node scripts/telemetry.mjs --trace <trace_id>
|
|
648
|
+
node scripts/telemetry.mjs --export report.json --since 7d
|
|
649
|
+
node scripts/telemetry.mjs --config telemetry.json
|
|
650
650
|
node scripts/telemetry.mjs --purge --before 30d
|
|
651
651
|
```
|
|
652
652
|
|
|
653
653
|
参数:
|
|
654
654
|
|
|
655
655
|
```text
|
|
656
|
-
--store jsonl|sqlite
|
|
657
|
-
--path <path>
|
|
658
|
-
--since <duration|timestamp>
|
|
659
|
-
--until <duration|timestamp>
|
|
660
|
-
--profile <name>
|
|
661
|
-
--model <name>
|
|
662
|
-
--plugin <name>
|
|
663
|
-
--event <name>
|
|
664
|
-
--group-by model|plugin|tool|profile|day
|
|
665
|
-
--format text|json|markdown
|
|
666
|
-
--sample-rate N
|
|
667
|
-
--errors-only
|
|
668
|
-
--slow-over-ms N
|
|
669
|
-
--capture-metadata none|safe
|
|
656
|
+
--store jsonl|sqlite
|
|
657
|
+
--path <path>
|
|
658
|
+
--since <duration|timestamp>
|
|
659
|
+
--until <duration|timestamp>
|
|
660
|
+
--profile <name>
|
|
661
|
+
--model <name>
|
|
662
|
+
--plugin <name>
|
|
663
|
+
--event <name>
|
|
664
|
+
--group-by model|plugin|tool|profile|day
|
|
665
|
+
--format text|json|markdown
|
|
666
|
+
--sample-rate N
|
|
667
|
+
--errors-only
|
|
668
|
+
--slow-over-ms N
|
|
669
|
+
--capture-metadata none|safe
|
|
670
670
|
--purge --before <duration>
|
|
671
671
|
```
|
|
672
672
|
|
|
@@ -689,19 +689,19 @@ DSH 插件名:`dsh-telemetry`,插件入口只负责:
|
|
|
689
689
|
建议配置文件:
|
|
690
690
|
|
|
691
691
|
```json
|
|
692
|
-
{
|
|
693
|
-
"enabled": true,
|
|
694
|
-
"store": "jsonl",
|
|
695
|
-
"path": "~/.dsh/telemetry",
|
|
696
|
-
"sample_rate": 1,
|
|
697
|
-
"errors_always_sample": true,
|
|
698
|
-
"slow_request_ms": 10000,
|
|
699
|
-
"capture_metadata": "none",
|
|
700
|
-
"hash_names": false,
|
|
701
|
-
"retention_days": 7,
|
|
702
|
-
"max_file_mb": 100,
|
|
703
|
-
"flush_interval_ms": 1000,
|
|
704
|
-
"price_catalog": null
|
|
692
|
+
{
|
|
693
|
+
"enabled": true,
|
|
694
|
+
"store": "jsonl",
|
|
695
|
+
"path": "~/.dsh/telemetry",
|
|
696
|
+
"sample_rate": 1,
|
|
697
|
+
"errors_always_sample": true,
|
|
698
|
+
"slow_request_ms": 10000,
|
|
699
|
+
"capture_metadata": "none",
|
|
700
|
+
"hash_names": false,
|
|
701
|
+
"retention_days": 7,
|
|
702
|
+
"max_file_mb": 100,
|
|
703
|
+
"flush_interval_ms": 1000,
|
|
704
|
+
"price_catalog": null
|
|
705
705
|
}
|
|
706
706
|
```
|
|
707
707
|
|
|
@@ -859,7 +859,7 @@ DSH 插件名:`dsh-telemetry`,插件入口只负责:
|
|
|
859
859
|
|
|
860
860
|
- Windows、Ubuntu。
|
|
861
861
|
|
|
862
|
-
- Node 18、20、22。
|
|
862
|
+
- Node 18、20、22(独立 JSONL/CLI 回归);SQLite 最低 Node 22.5;DSH 宿主 compat 固定 Node 22.19。
|
|
863
863
|
|
|
864
864
|
- CRLF、UTF-8 BOM、中文路径。
|
|
865
865
|
|
|
@@ -910,11 +910,11 @@ DSH 插件名:`dsh-telemetry`,插件入口只负责:
|
|
|
910
910
|
推荐链路:
|
|
911
911
|
|
|
912
912
|
```text
|
|
913
|
-
DSH Harness
|
|
914
|
-
-> dsh-telemetry:记录调用事实
|
|
915
|
-
-> dsh-change-impact:分析代码变更影响
|
|
916
|
-
-> dsh-test-insight:规划测试保护
|
|
917
|
-
-> dsh-refactor-insight:处理长期结构风险
|
|
913
|
+
DSH Harness
|
|
914
|
+
-> dsh-telemetry:记录调用事实
|
|
915
|
+
-> dsh-change-impact:分析代码变更影响
|
|
916
|
+
-> dsh-test-insight:规划测试保护
|
|
917
|
+
-> dsh-refactor-insight:处理长期结构风险
|
|
918
918
|
-> dsh-data-insight:分析业务数据
|
|
919
919
|
```
|
|
920
920
|
|
|
@@ -951,4 +951,3 @@ DSH Harness
|
|
|
951
951
|
- [ ] DSH 插件安装后不改变请求语义。
|
|
952
952
|
|
|
953
953
|
- [ ] README、schema、配置样例、CHANGELOG 和发布包一致。
|
|
954
|
-
|
package/PUBLISHING.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## 发布前检查清单
|
|
10
10
|
|
|
11
|
-
1. 运行 `npm test`(
|
|
11
|
+
1. 运行 `npm test`(128/128 全绿)与 `npm run check`(全模块语法检查),确保全部通过。
|
|
12
12
|
2. 运行 `npm pack --dry-run`,确认包含 `plugin/index.js`、`cordis.patch.yml`、`skills/`、`src/`、`bin/`、`web/`、`docs/`、`examples/`、`README.md`、`CHANGELOG.md`、`LICENSE`、`PUBLISHING.md`、`DSH-TELEMETRY-开发计划.md`。
|
|
13
13
|
3. 版本一致性:`package.json` version、`bin/telemetry.mjs` USAGE 版本号、`src/aggregate.mjs` `tool.version`、`CHANGELOG.md` 发布段、git tag 五处保持一致(manifest 契约测试覆盖前三处)。
|
|
14
14
|
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
### GitHub
|
|
26
26
|
|
|
27
|
-
1. push `main
|
|
28
|
-
2. 打 tag `v0.1.
|
|
27
|
+
1. push `main`,确认独立 JSONL/CLI 回归 CI 全绿(Node 18/20/22 × Windows/Ubuntu),并确认 Node 22.19 的 DSH compat job 通过。
|
|
28
|
+
2. 打 tag `v0.1.1` 并推送。
|
|
29
29
|
3. 给仓库添加 GitHub topic `dsh-plugin`(awesome 收录门槛之一)。
|
|
30
30
|
|
|
31
31
|
### npm
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://github.com/topics/dsh-plugin)
|
|
5
5
|
[](https://github.com/duyanta123/dsh-telemetry/actions/workflows/ci.yml)
|
|
6
6
|
[](https://www.npmjs.com/package/dsh-local-telemetry)
|
|
7
|
-
[](CHANGELOG.md)
|
|
8
8
|
|
|
9
9
|
本地优先的 Harness 运行遥测插件:记录请求、模型、工具与插件生命周期指标(延迟、Token、成本、错误、缓存),默认不采集内容。
|
|
10
10
|
|
|
@@ -27,6 +27,22 @@ dsh-telemetry 是 Harness 运行可观测性插件,不负责业务分析,不
|
|
|
27
27
|
|
|
28
28
|
> Make Harness behavior measurable without collecting sensitive conversation content by default.
|
|
29
29
|
|
|
30
|
+
## 界面预览
|
|
31
|
+
|
|
32
|
+
**一屏总览**——请求、P95 延迟、首 Token 延迟、Token/缓存命中、估算成本(配置价格目录后自动计算)与错误分类,全部指标标注样本数,可由原始事件重算:
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
**工具与插件耗时**——循环调用 ⚠ 提示、需用户确认的调用计数、插件 hook 错误统计;下方请求时间线以状态点区分成功/失败/取消,重试请求带 ↻ 标记:
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
**Trace 详情**——点击任意请求展开 span 树与事件时间线;下图展示 deepseek-reasoner 触发 rate_limit 后回退 deepseek-chat 成功的完整链路(每个 attempt 独立计时):
|
|
41
|
+
|
|
42
|
+

|
|
43
|
+
|
|
44
|
+
> 以上截图为本地只读 Web UI(`--ui`,仅绑定 127.0.0.1),数据为演示数据集;默认配置下不采集 prompt / response / 文件内容 / 密钥。
|
|
45
|
+
|
|
30
46
|
## 安装
|
|
31
47
|
|
|
32
48
|
作为 DSH 插件(推荐):
|
|
@@ -35,6 +51,8 @@ dsh-telemetry 是 Harness 运行可观测性插件,不负责业务分析,不
|
|
|
35
51
|
dsh plugin --profile web add "github:duyanta123/dsh-telemetry#main"
|
|
36
52
|
```
|
|
37
53
|
|
|
54
|
+
兼容性分层:JSONL 和纯 CLI 能力可独立运行在 Node.js >= 18;SQLite 后端要求 Node.js >= 22.5;作为 DSH 0.1.2-rc.1 插件验证统一使用 Node.js >= 22.19。运行 `npm run test:compat` 可执行隔离 profile 的 add、dump-config 和启动 smoke test。
|
|
55
|
+
|
|
38
56
|
或从 npm 安装(作为库或独立 CLI 使用):
|
|
39
57
|
|
|
40
58
|
```bash
|
package/bin/telemetry.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { loadPriceCatalog } from "../src/cost.mjs";
|
|
|
22
22
|
import { renderTextSummary, renderMarkdownReport, renderTraceText, renderGroupedText } from "../src/report.mjs";
|
|
23
23
|
import { createTelemetryServer } from "../src/server.mjs";
|
|
24
24
|
|
|
25
|
-
const USAGE = `dsh-local-telemetry — 本地 Harness 遥测查询 CLI(v0.1.
|
|
25
|
+
const USAGE = `dsh-local-telemetry — 本地 Harness 遥测查询 CLI(v0.1.1)
|
|
26
26
|
|
|
27
27
|
用法:
|
|
28
28
|
node bin/telemetry.mjs --status
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-local-telemetry",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "本地优先的 Harness 运行遥测插件:记录请求、模型、工具与插件生命周期指标(延迟、Token、成本、错误、缓存),默认不采集内容。Local-first Harness telemetry plugin for DeepSeek Harness. npm 包 dsh-local-telemetry(dsh-telemetry 名已被第三方占用)。",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/duyanta123/dsh-telemetry.git"
|
|
8
|
+
},
|
|
5
9
|
"type": "module",
|
|
6
10
|
"main": "./plugin/index.js",
|
|
7
11
|
"exports": {
|
|
@@ -30,6 +34,7 @@
|
|
|
30
34
|
],
|
|
31
35
|
"scripts": {
|
|
32
36
|
"test": "node --test test/schema.test.mjs test/config.test.mjs test/privacy.test.mjs test/cost.test.mjs test/sink.test.mjs test/recorder.test.mjs test/store.test.mjs test/aggregate.test.mjs test/cli.test.mjs test/server.test.mjs test/manifest.test.mjs",
|
|
37
|
+
"test:compat": "node test/dsh-compat.test.mjs",
|
|
33
38
|
"prepublishOnly": "npm test",
|
|
34
39
|
"check": "node --check bin/telemetry.mjs && node --check src/index.mjs && node --check src/schema.mjs && node --check src/config.mjs && node --check src/privacy.mjs && node --check src/sampling.mjs && node --check src/cost.mjs && node --check src/sink-jsonl.mjs && node --check src/sink-sqlite.mjs && node --check src/adapter.mjs && node --check src/recorder.mjs && node --check src/store.mjs && node --check src/aggregate.mjs && node --check src/report.mjs && node --check src/server.mjs && node --check plugin/index.js"
|
|
35
40
|
},
|
package/plugin/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { createRequire } from "node:module";
|
|
|
16
16
|
import { createRecorder } from "../src/recorder.mjs";
|
|
17
17
|
|
|
18
18
|
export const name = "dsh-local-telemetry";
|
|
19
|
+
export const inject = ["skills"];
|
|
19
20
|
|
|
20
21
|
const rootDir = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
21
22
|
const skillsDir = join(rootDir, "skills");
|
package/src/aggregate.mjs
CHANGED
|
@@ -453,7 +453,7 @@ export function aggregateEvents(events, { catalog = null, catalogPath = null, ge
|
|
|
453
453
|
const requestsTotal = requests.length;
|
|
454
454
|
return {
|
|
455
455
|
schema_version: "1.0",
|
|
456
|
-
tool: { name: "dsh-local-telemetry", version: "0.1.
|
|
456
|
+
tool: { name: "dsh-local-telemetry", version: "0.1.1" },
|
|
457
457
|
generated_at: generated,
|
|
458
458
|
window,
|
|
459
459
|
data_completeness: {
|