Node.js 自动监测

Node.js 自动监测为 Node.js 应用提供自动的遥测数据采集,包括流行的框架如 Express、Fastify 和 Nest.js。该监测能够捕获来自 Node.js 应用的追踪、指标和日志,无需修改代码。

Operator 会将 OpenTelemetry Node.js 自动监测注入到 Node.js 应用容器中,自动配置以监测常用的库和框架。这使得运行在 Kubernetes 中的 Node.js 工作负载具备全面的可观测性。

启用 Node.js 监测

要启用 Node.js 应用的自动监测,请在 Pod 或命名空间中添加注解:

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

Operator 会自动注入监测组件,并配置 Node.js 运行时在启动时加载它们。

配置参考

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

Node.js Auto-instrumentation Documentation