instrument-with-sazabi
它能做什么
这个技能设置应用,使其日志和追踪能够发送到 Sazabi。适合希望让服务在 Sazabi 中可见,同时又不把机密信息放进代码库的开发者。
适用场景
- ✓当你想把应用或服务连接到 Sazabi 的时候。
- ✓当你想为项目添加 OpenTelemetry 日志或追踪的时候。
- ✓当 Sazabi 中某个服务没有任何数据,你需要查明原因的时候。
技能链接
https://github.com/ParadevAI/Paradev/blob/main/plugins/sazabi/skills/instrument-with-sazabi/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把我的 Node API 用 OpenTelemetry 连接到 Sazabi,并确认第一批日志已经到达。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会从 Sazabi 获取接收地址,并把它保存在环境变量中,而不是代码里。它会为应用的编程语言设置官方的 OpenTelemetry SDK,并在确认第一批记录已到达 Sazabi 之后,才认为任务完成。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Data in, proven
Sazabi can only answer questions about telemetry it receives. The job is to make the app export logs and traces over OpenTelemetry to the user's Sazabi project, with no secrets in the repo, and to show the first records arriving.
0. How the tools work
The Sazabi MCP server lists only two tools, search and execute. Browse
Sazabi's operations with search and namespace: "sazabi" (an empty query
without a namespace lists connected connectors, not Sazabi operations). Before
calling one, repeat search with namespace: "sazabi", the hit's full name as
the query, and includeInputSchema: true to load its arguments. Then run it
with execute as { name, arguments }, the name copied from the hit (for
example sazabi/logs.ask).
1. Get an intake URL
Run sazabi/logSources.list first; an OpenTelemetry source may already exist
for this project. If not, sazabi/logSources.create in manual mode for an
OpenTelemetry source returns the intake endpoint to point the sender at. The
intake URL embeds a write-only public key, so it needs no auth header, but it
still belongs in an environment variable or secret store, not in committed
code. Metrics go to the separate OpenTelemetry Metrics source, which has its
own intake path.
2. Wire the SDK
Use the official OpenTelemetry SDK for the runtime and initialize it before the app handles requests:
- Node.js:
@opentelemetry/sdk-node,@opentelemetry/auto-instrumentations-node,@opentelemetry/exporter-trace-otlp-proto,@opentelemetry/exporter-logs-otlp-protoand@opentelemetry/sdk-logs. Auto-instrumentation exports traces but not logs, so add aBatchLogRecordProcessorwith anOTLPLogExporter, and bridge the app's existing logger (pino, winston) instead of replacing it. - Python:
opentelemetry-distroandopentelemetry-exporter-otlp-proto-http, thenopentelemetry-bootstrap -a install, and enable the logging handler. - Other runtimes: the standard OTLP/HTTP exporter for that SDK.
Configure through the standard environment variables, set in the process that runs the app (not only at build time or in CI):
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_ENDPOINT=<intake URL>
OTEL_SERVICE_NAME=<service name>
Set OTEL_SERVICE_NAME and deployment.environment so every record says
which service and environment it came from. Add the variable names to
.env.example or the deploy config, with the value left to the user.
3. Prove it
Run the app (or deploy it), make a request, then ask Sazabi with
sazabi/logs.ask: "how many records from service <name> in the last 15
minutes". Records usually show up within a minute or two. If none arrive,
check that the variables are set in the running process, that the URL has its
https:// scheme, and the app's output for SDK initialization errors.
4. Hand off
Commit on a branch and open a pull request. Say which signals are flowing (logs, traces), which service name to search for, and which variables the user must set in each environment.
Anti-patterns
- Committing the intake URL. It is a write key; keep it in configuration.
- Traces only. Most debugging starts from log lines; export both.
- Calling it done before a record arrives. Configuration that has never delivered a record is a guess.
常见问题
Sazabi 的地址会出现在我的代码里吗?
不会。技能把它保存在环境变量或机密存储中,而不是放进已提交的代码。
它使用哪个 SDK?
它使用你的应用所用语言对应的官方 OpenTelemetry SDK。
我怎么知道它是否有效?
技能会先确认第一批记录已经到达 Sazabi,然后才会把设置视为完成。
详情
作者的原始描述
Get an application's logs and traces into Sazabi with OpenTelemetry — pick the SDK for the runtime, export over OTLP/HTTP to a Sazabi intake URL kept in an environment variable, and prove data arrives before calling it done. Use when the user wants to connect an app or service to Sazabi, add OpenTelemetry, set up logging or tracing, or asks why Sazabi shows no data for a service.
repo: ParadevAI/Paradev
热度
- GitHub 星标
- 16k
- 排名
- #10843
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …