elixir 的弹性 apm 和 opentelemetry 的使用

elastic apm for elixir and use of opentelemtry

我们想使用弹性 apm 跟踪我们的 elixir phoenix 应用程序。但是我找不到elastic的apm代理。

有人建议将 opentelemetry 与导出器一起使用,但我无法理解如何从文档中使用它。我想跟踪细节,比如新遗物确实喜欢错误和所有事情。

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

确实,没有适用于 Elastic APM 的 Elixir 代理 - 您可以投票 this issue 以获得更多关注。

如您所见,您可以同时使用 OpenTelemetry。为此,运行 OpenTelemetry contrib 收集器(otel 收集器)并将其配置为导出到 elastic - 有一个完整的解释 in the docs 以及此示例配置:

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]

在您的应用程序中,使用 opentelemetry exporter.

配置跟踪器

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

Erlang/Elixir Agent Docs 有启动和装饰 span 的示例代码。