Akka HTTP请求无法通过OpenTelemetry进行跟踪。

huangapple go评论67阅读模式
英文:

Akka http request does not trace through opentelemetry

问题

以下是您提供的文本的翻译:

我正在尝试在 akka-http 应用程序(Scala)中使用独立代理中的 OpenTelemetry(OTEL)。在我的 sbt 中,我有以下配置:

fork := true

run / javaOptions ++= Seq(
  "-XX:+UseG1GC",
  "-XX:MaxGCPauseMillis=100",
  "-XX:+PrintGCDetails",
  "-XX:+PrintTenuringDistribution",
  "-XX:+PrintGCCause",
  "-XX:+PrintAdaptiveSizePolicy",
  "-javaagent:/myFolder/jars/opentelemetry-javaagent.jar",
  "-Dotel.service.name=pantryLocalExecution",
  "-Dotel.traces.exporter=otlp",
  "-Dotel.metrics.exporter=otlp",
)
envVars += "OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" -> "true"

我正在使用 Jeager 监视 OTEL 收集的所有指标,但问题是,Jeager 不显示 HTTP 请求,只显示 MySQL 连接。此外,它还没有将相同的流程分组到相同的跟踪中。下面的图片显示了我的意思。有三个相同流程的跟踪。

Akka HTTP请求无法通过OpenTelemetry进行跟踪。

感谢大家的帮助!

快速提示:

  • 我确信代理路径是正确的。
  • 在使用 Jaeger UI 之前,我需要运行以下 Docker 命令:
    ** docker run -d --name jaeger \\ -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \\ -e COLLECTOR_OTLP_ENABLED=true \\ -p 6831:6831/udp \\ -p 6832:6832/udp \\ -p 5778:5778 \\ -p 16686:16686 \\ -p 4317:4317 \\ -p 4318:4318 \\ -p 14250:14250 \\ -p 14268:14268 \\ -p 14269:14269 \\ -p 9411:9411 \\ jaegertracing/all-in-one:1.42
  • 最后,我使用 sbt run 命令运行应用程序。
英文:

I am trying to use opentelemtry (OTEL) in akka-http application (Scala), using the stand alone agent.
In my sbt I have this:

fork := true

run / javaOptions ++= Seq(
  "-XX:+UseG1GC",
  "-XX:MaxGCPauseMillis=100",
  "-XX:+PrintGCDetails",
  "-XX:+PrintTenuringDistribution",
  "-XX:+PrintGCCause",
  "-XX:+PrintAdaptiveSizePolicy",
  "-javaagent:/myFolder/jars/opentelemetry-javaagent.jar",
  "-Dotel.service.name=pantryLocalExecution",
  "-Dotel.traces.exporter=otlp",
  "-Dotel.metrics.exporter=otlp",
)
envVars += "OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" -> "true"

I am using Jeager to watch all metrics that OTEL collects, then thing is, Jeager is not showing Http request, only mysql connections.
Addition to that, is not grouping the flow into the same trace, Next image show what I mean. There are 3 traces which are the same flow.

Akka HTTP请求无法通过OpenTelemetry进行跟踪。

Thank you all for all your help!!

Quick notes:

  • I am sure that the agent path is ok.

  • Before use Jaeger UI i needed to run docker command:
    ** docker run -d --name jaeger \\n -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \\n -e COLLECTOR_OTLP_ENABLED=true \\n -p 6831:6831/udp \\n -p 6832:6832/udp \\n -p 5778:5778 \\n -p 16686:16686 \\n -p 4317:4317 \\n -p 4318:4318 \\n -p 14250:14250 \\n -p 14268:14268 \\n -p 14269:14269 \\n -p 9411:9411 \\n jaegertracing/all-in-one:1.42\

  • Finally I run using sbt run command.

答案1

得分: 1

只有在使用 10.2.0-RC2 版本或更高版本的 Akka 时,我才发现 OTEL 只能按照我想要的方式工作(具有与子跨度相同的流程)。请牢记我发布的所有设置!

谢谢大家!

英文:

Finding and finding and creating small projects with different versions, I discovered that OTEL only works as I want (The same flow with child spans), only is necessary 10.2.0-RC2 version of akka or higher.
Just keep in mind all the settings that I posted!

Thank you all!!

huangapple
  • 本文由 发表于 2023年2月16日 05:32:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75465642.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定