用于长生不老药的弹性 apm 和使用 opentelemtry

rel*_*ess 2 phoenix elixir elasticsearch telemetry elastic-apm

我们想使用 elastic apm 跟踪我们的 elixir phoenix 应用程序。但是我无法从elastic中找到apm代理。

有人建议opentelemetry与 exporter 一起使用,但我无法从文档中了解如何使用它。我想跟踪细节,就像新遗物一样,比如错误和所有事情。

以前我们使用新的relic,它有一个开源的apm代理,但现在我们想切换到elastic。我无法理解如何在应用程序中使用span以及如何处理多个span以及将它们放在哪里。如果有人可以提供帮助或提供使用弹性 apm 的替代解决方案,那就太好了。

小智 5

确实,没有用于 Elastic APM 的 Elixir 代理 - 您可以对此问题进行投票以引起更多关注。

正如您所发现的,您可以同时使用 OpenTelemetry。为此,请运行 OpenTelemetry contrib 收集器(otel 收集器)并将其配置为导出到elastic-文档中有完整的说明以及此示例配置:

receivers:
  otlp:
    endpoint: localhost:55680
processors:
  batch:
    timeout: 1s
    send_batch_size: 1024
exporters:
  elastic:
    apm_server_url: "https://elasticapm.example.com"
    secret_token: "ESS_TOKEN"
service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [elastic]
Run Code Online (Sandbox Code Playgroud)

在您的应用程序中,使用opentelemetry exporter配置跟踪器。

那时,您的应用程序中将有一个跟踪器将跟踪发送到 otel 收集器。从那里,跟踪将通过 APM 服务器导出到 Elastic Stack。总之:your app -> otel collector -> apm-server -> elasticsearch

二郎/药剂代理的文档具有启动装潢跨度示例代码。