ali*_*227 5 ruby-on-rails exporter kubernetes open-telemetry
我正在使用 opentelemetry-ruby otlp 导出器进行自动检测: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/exporter/otlp
otel 收集器作为守护进程安装: https://github.com/open-telemetry/opentelemetry-helm-charts/tree/main/charts/opentelemetry-collector
我正在尝试让 OpenTelemetry 收集器从 Rails 应用程序收集跟踪。两者都在同一集群中运行,但在不同的命名空间中。
我们已在应用程序中启用自动检测,但 Rails 日志当前显示以下错误:
E, [2022-04-05T22:37:47.838197 #6] ERROR -- : OpenTelemetry error: Unable to export 499 spans
我在应用程序中设置了以下环境变量:
OTEL_LOG_LEVEL=debug
OTEL_EXPORTER_OTLP_ENDPOINT=http://0.0.0.0:4318
Run Code Online (Sandbox Code Playgroud)
我无法确认应用程序可以与此端口上的收集器 Pod 进行通信。从 Rails/Ruby 应用程序中获取此地址会返回“连接被拒绝”。但是我可以使用curlhttp://<OTEL_POD_IP>:4318来返回404 页面未找到。
从 Pod 内部:
# curl http://localhost:4318/
curl: (7) Failed to connect to localhost port 4318: Connection refused
# curl http://10.1.0.66:4318/
404 page not found
Run Code Online (Sandbox Code Playgroud)
此 Helm Chart 创建了一个守护进程集,但没有正在运行的服务。我需要启用一些设置才能使其正常工作吗?
我确认 otel-collector 正在集群中的每个节点上运行,并且 daemonset 的 HostPort 设置为 4318。
问题出在这个设置上:
OTEL_EXPORTER_OTLP_ENDPOINT=http://0.0.0.0:4318
Run Code Online (Sandbox Code Playgroud)
将您的 Pod 想象为一个剥离的主机本身。pod 的本地主机或 0.0.0.0,并且您的 pod 中没有部署收集器。
您需要使用收集者提供的地址。我已经检查了共享存储库中可用的示例agent-and-standalone,并且您standalone-only还有一个 Service 类型的 k8s 资源。
这样您就可以使用完整的服务名称(带有命名空间)来配置环境变量。
另外,环境变量现在被称为OTEL_EXPORTER_OTLP_TRACES_ENDPOINT,所以你将需要这样的东西:
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=<service-name>.<namespace>.svc.cluster.local:<service-port>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11726 次 |
| 最近记录: |