DeepSeek Harness 接入可观测
更新时间:2026-09-14
DeepSeek Harness 接入可观测
通过开源的 LoongSuite DeepSeek Harness Observability Plugin 将 DeepSeek Harness 的 Trace 上报至 云监控 BCM → Agent 可观测。
该插件基于 DeepSeek Harness 原生 Plugin 机制运行,无需修改 Harness 源码。插件会采集 Agent 会话中的模型调用、工具调用、Token 用量、TTFT、调用耗时及错误信息,并转换为标准 OpenTelemetry GenAI Trace 后通过 OTLP/HTTP 上报。
前提条件
- 已安装并使用过 DeepSeek Harness,本机存在 ~/.dsh 目录或可在终端调用 dsh 命令
- Node.js ≥
22.19;如本机未安装,可使用 nvm 安装:
Plain Text
1# 安装 nvm
2curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
3
4# 用 nvm 安装 v22 版本的 Node.js
5nvm install 22
步骤1:获取接入点与 Token
- 接入点:
http://apm-collector.bj.baidubce.com - Authentication:
<Authentication>
步骤2:安装 LoongSuite Pilot
Plain Text
1curl -fsSL https://loongcollector-community-edition.oss-cn-shanghai.aliyuncs.com/loongsuite-pilot/installer.sh \
2 -o /tmp/loongsuite-pilot-installer.sh && \
3bash /tmp/loongsuite-pilot-installer.sh install
验证接入状态
Plain Text
1# 查看 LoongSuite Pilot 运行状态
2loongsuite-pilot status
3# 查看当前采集配置和组件发现结果
4loongsuite-pilot info
步骤3:配置百度 Agent 可观测接入信息
编辑:
Plain Text
1vim ~/.loongsuite-pilot/config.json
配置成类似:
JSON
1{
2 "collectLog": false,
3 "collectTrace": true,
4 "serviceName": "deepseek-harness",
5 "otlpTrace": {
6 "endpoint": "<endpoint>",
7 "headers": {
8 "authentication": "<authentication>"
9 },
10 "captureMessageContent": true,
11 "debug": true
12 }
13}
| 参数 | 描述 | 示例 |
|---|---|---|
| serviceName | 上报到百度 Agent可观测 的应用名称 | deepseek-harness |
| otlpTrace.headers.authentication |
步骤 1 中拿到业务系统 Authentication | <Authentication> |
| otlpTrace.endpoint | 步骤 1 中拿到的接入点 | http://apm-collector.bj.baidubce.com |
| otlpTrace.captureMessageContent | 是否将模型输入输出上报至百度 Agent 可观测 平台 | true |
步骤4:重启
Plain Text
1loongsuite-pilot restart
验证接入状态:
Plain Text
1loongsuite-pilot status
2loongsuite-pilot info
步骤5:验证接入
重新启动 DeepSeek Harness:
Plain Text
1dsh web # 或npx @deepseek-ai/dsh@latest web
发起一次完整 Agent 对话,例如:
Plain Text
1你好,请只回复 hello
等待本轮 Agent 执行结束后,应产生增量采集结果。可通过以下命令查看会话事件目录:
Plain Text
1ls "$HOME/.loongsuite-pilot/logs/dsh"
DeepSeek Harness 的会话事件以 JSONL 文件形式按会话写入,文件名形如 dsh-
然后到 云监控 BCM → Agent 可观测 搜索 service.name = <你设置的应用名> 查看 Trace 数据。由于数据的处理存在一定延时,如果接入后在控制台没有查询到应用,请等待 30 秒左右。
评价此篇文章
