open-telemetry/opentelemetry-go

GitHub: open-telemetry/opentelemetry-go

OpenTelemetry 的 Go 语言官方 SDK,为分布式系统提供链路追踪、指标和日志的统一遥测采集标准。

Stars: 6299 | Forks: 1268

# OpenTelemetry-Go [![ci](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/514b39adca141559.svg)](https://github.com/open-telemetry/opentelemetry-go/actions/workflows/ci.yml) [![codecov.io](https://codecov.io/gh/open-telemetry/opentelemetry-go/coverage.svg?branch=main)](https://app.codecov.io/gh/open-telemetry/opentelemetry-go?branch=main) [![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel)](https://pkg.go.dev/go.opentelemetry.io/otel) [![Go Report Card](https://goreportcard.com/badge/go.opentelemetry.io/otel)](https://goreportcard.com/report/go.opentelemetry.io/otel) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/open-telemetry/opentelemetry-go/badge)](https://scorecard.dev/viewer/?uri=github.com/open-telemetry/opentelemetry-go) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9996/badge)](https://www.bestpractices.dev/projects/9996) [![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/opentelemetry-go.svg)](https://issues.oss-fuzz.com/issues?q=project:opentelemetry-go) [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-go.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-go?ref=badge_shield&issueType=license) [![Slack](https://img.shields.io/badge/slack-@cncf/otel--go-brightgreen.svg?logo=slack)](https://cloud-native.slack.com/archives/C01NPAXACKT) OpenTelemetry-Go 是 [OpenTelemetry](https://opentelemetry.io/) 的 [Go](https://golang.org/) 实现。 它提供了一组 API,用于直接测量软件的性能和行为,并将这些数据发送到可观测性平台。 ## 项目状态 | Signal | Status | |---------|--------------------| | Traces | Stable | | Metrics | Stable | | Logs | Beta[^1] | 本仓库特有的进展和状态在我们的 [项目看板](https://github.com/open-telemetry/opentelemetry-go/projects) 和 [里程碑](https://github.com/open-telemetry/opentelemetry-go/milestones) 中进行跟踪。 项目版本信息和稳定性保证可以在 [版本控制文档](VERSIONING.md) 中找到。 ### 兼容性 OpenTelemetry-Go 确保与当前支持的 [Go 语言](https://golang.org/doc/devel/release#policy) 版本兼容: 对于上游不再支持的 Go 版本,opentelemetry-go 将按以下方式停止确保与这些版本的兼容性: - 发布一个 opentelemetry-go 的次要版本以支持新的 Go 支持版本。 - 随后的 opentelemetry-go 次要版本将移除对最旧(现已被上游归档)Go 版本的兼容性测试。该版本及未来的 opentelemetry-go 版本可能包含仅受当前支持的 Go 版本支持的功能。 目前,本项目支持以下环境。 | OS | Go Version | Architecture | |----------|------------|--------------| | Ubuntu | 1.26 | amd64 | | Ubuntu | 1.25 | amd64 | | Ubuntu | 1.26 | 386 | | Ubuntu | 1.25 | 386 | | Ubuntu | 1.26 | arm64 | | Ubuntu | 1.25 | arm64 | | macOS | 1.26 | amd64 | | macOS | 1.25 | amd64 | | macOS | 1.26 | arm64 | | macOS | 1.25 | arm64 | | Windows | 1.26 | amd64 | | Windows | 1.25 | amd64 | | Windows | 1.26 | 386 | | Windows | 1.25 | 386 | 虽然该项目应该能在其他系统上运行,但目前不对这些系统做出兼容性保证。 ## 快速开始 您可以在 [opentelemetry.io](https://opentelemetry.io/docs/languages/go/getting-started/) 上找到入门指南。 OpenTelemetry 的目标是提供一组统一的 API,用于从您的应用程序中捕获分布式 Traces 和 Metrics,并将它们发送到可观测性平台。该项目使您能够针对使用 Go 编写的应用程序实现这一目标。此过程包含两个步骤:检测您的应用程序,以及配置一个 Exporter。 ### 检测 要开始从您的应用程序中捕获分布式 Traces 和 Metric 事件,首先需要对其进行检测。最简单的方法是为您的代码使用检测库。请务必查看[官方支持的检测库](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation)。 如果您需要扩展检测库提供的遥测数据,或者希望直接为您的应用程序构建自己的检测,您将需要使用 [Go otel](https://pkg.go.dev/go.opentelemetry.io/otel) 包。[示例](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/examples) 是了解此过程一些实际用途的好方法。 ### 导出 既然您的应用程序已经过检测以收集遥测数据,它需要一个导出管道来将该遥测数据发送到可观测性平台。 OpenTelemetry 项目所有官方支持的 Exporter 都包含在 [exporters 目录](./exporters) 中。 | Exporter | Logs | Metrics | Traces | |---------------------------------------|:----:|:-------:|:------:| | [OTLP](./exporters/otlp/) | ✓ | ✓ | ✓ | | [Prometheus](./exporters/prometheus/) | | ✓ | | | [stdout](./exporters/stdout/) | ✓ | ✓ | ✓ | | [Zipkin](./exporters/zipkin/) | | | ✓ | ## 贡献 请参阅[贡献文档](CONTRIBUTING.md)。
标签:API集成, APM, CNCF, EVTX分析, EVTX分析, GET参数, Go, Golang, Logging, Metrics, OpenTelemetry, Python工具, Ruby工具, Tracing, web渗透, 分布式系统, 分布式追踪, 可观测性, 响应大小分析, 安全编程, 应用性能监控, 开发库, 性能分析, 指标监控, 日志审计, 日志收集, 用户代理, 监控工具, 自定义请求头, 遥测数据