Go 自动监测

Go 自动监测通过利用 eBPF(Extended Berkeley Packet Filter)技术,实现对 Go 应用的自动遥测数据采集。该方法在运行时对 Go 应用进行监测,无需修改代码或重新编译。

Operator 将 OpenTelemetry Go 自动监测组件注入到 Go 应用容器中,使用 eBPF 捕获函数调用、HTTP 请求及其他遥测数据,从而以极低的性能开销为 Go 应用提供可观测性。

启用 Go 监测

要启用 Go 应用的自动监测,请为您的 pod 或命名空间添加注解:

apiVersion: v1
kind: Pod
metadata:
  name: go-app
  annotations:
    instrumentation.opentelemetry.io/inject-go: "true"
spec:
  containers:
  - name: app
    image: mygoapp:latest

当 pod 创建时,Operator 会自动注入监测组件。

配置参考

有关详细的配置选项、支持的 Go 版本及高级使用场景,请参阅官方 OpenTelemetry Operator 文档:

Go Auto-instrumentation Documentation