docs: 本地 trace 文件路径改名 + 补充产生/上传 trace 排查文档#3263
Open
chenjw wants to merge 1 commit into
Open
Conversation
- 将默认本地 trace 路径从 ~/.openviking/data/traces/offline-traces.jsonl 改为 ~/.openviking/logs/traces.jsonl,不再建 traces 子目录 - 新增 upload_offline_trace.py 脚本,支持上传 JSONL trace 到远端 OTLP - 上传脚本上传成功后收集并打印 trace_id 列表 - 在中英文 observability guide 中新增「产生本地 Trace 并提交排查」一节, 覆盖用户开启 local trace、复现问题、提交 JSONL 给管理员、管理员上传的完整流程 - 更新 test_server_config_loader.py 断言
c8a8e68 to
c66cfc4
Compare
| try: | ||
| for file_path in files: | ||
| file_path = file_path.expanduser() | ||
| if not file_path.exists(): |
Collaborator
There was a problem hiding this comment.
[Bug] (blocking) 当 --file 指向的主文件不存在时,这里只是把路径记到 missing_files 然后继续,最后 main() 仍然会打印 Uploaded: batches: 0 并 return 0。我本地按这个脚本做了最小复现:传一个不存在的 traces.jsonl,脚本最终退出码仍是 0。对管理员来说,这会把“根本没有上传任何 trace”伪装成一次成功提交,容易误判排查结果。建议至少在以下任一场景返回非 0:显式传入的主文件不存在、loaded_files 为空,或 uploaded_batches == 0。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动概述
本 PR 新增了本地 trace 产生与上传排查的完整能力,方便用户在离线环境复现问题后将 trace 提交给管理员排查。
1. 新增本地 trace JSONL 导出器
在
openviking/telemetry/tracer.py中新增LocalJsonlSpanExporter,当server.observability.traces.protocol设为"local"时,将 OTLP trace 以 JSONL 格式写到本地文件~/.openviking/logs/traces.jsonl,支持按大小轮转(local_rotation_mb/local_backup_count)。在
openviking/server/config.py的OTelExporterConfig中新增local_path、local_rotation_mb、local_backup_count配置字段。2. 新增
tests/upload_offline_trace.py上传脚本完整的离线 trace JSONL 上传工具,支持:
ov.conf作为上传目标配置(需 protocol=grpc/http)traces.jsonl.2→traces.jsonl.1→traces.jsonl)--no-include-rotated只上传当前文件--config指定独立的上传配置3. 补充「产生本地 Trace 并提交排查」文档
在
docs/zh/guides/05-observability.md和docs/en/guides/05-observability.md中新增一节 "产生本地 Trace 并提交排查",完整描述了:protocol=local,文件写到~/.openviking/logs/traces.jsonl,支持按大小轮转trace_id)提交给管理员/支持人员tests/upload_offline_trace.py上传trace_id列表,方便管理员定位使用说明
用户侧(产生 trace)
在
~/.openviking/ov.conf中配置:{ "server": { "observability": { "traces": { "enabled": true, "protocol": "local" } } } }重启服务后复现问题,文件会写到
~/.openviking/logs/traces.jsonl。用户把文件打包交给管理员即可。管理员侧(上传 trace)
上传成功后会输出 trace_id 列表,管理员据此在 Jaeger 等排查工具中查看。
测试
python -m pytest tests/test_server_config_loader.py— 28 passed ✅