Files
myWiki/concepts/open-telemetry.md

38 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "OpenTelemetry (OTel)"
created: 2026-06-10
updated: 2026-06-10
type: concept
tags: [observability, standards, tracing, open-telemetry]
sources: [raw/articles/pydantic-three-piece-suite-2026.md]
---
# OpenTelemetry (OTel)
> CNCF 孵化的可观测性标准,定义了一套统一的 tracing、metrics、logging 数据格式和传输协议。
## 核心价值
- **厂商中立**:数据格式开放,不锁定任何后端
- **标准语义**:定义 `gen_ai.operation.name``gen_ai.usage.input_tokens` 等标准字段,框架层自动遵守
- **多后端分发**:同一份数据可同时发送到 Grafana、Jaeger、[[logfire|Logfire]] 等
## 在 Pydantic 生态中的应用
[[logfire|Logfire]] 基于 OTel 标准构建,因此:
- trace 数据可导出到任何 OTel 兼容后端
- 可通过 OpenTelemetry Collector 做数据清洗/采样
- 即使 Logfire 公司不存在了trace 数据格式仍然可读
## 典型架构
```
你的代码 → OTLP → Collector清洗/采样)→ Logfire / Grafana / Jaeger
```
## 参考
- [[logfire|Logfire]]
- [[agent-observability|Agent 可观测性]]
- [[drift-detection|漂移检测]]