有没有办法在跟踪的生命周期中的任何起始点处获取请求的完整跟踪信息?

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

Is there a way to get the full trace of a request given a starting point from anywhere in the lifecycle of the trace?

问题

在跟踪的生命周期中的任何起始点,是否有一种方法可以获取完整的跟踪请求?

基本上,如果我有一个跟踪的中间点或结束点,我能否使用这些点来获取请求的完整跟踪?

我想构建一个跟踪服务(使用Golang),其中该服务可以在请求的跟踪过程中的任何时间点返回请求的完整跟踪。

我已经尝试搜索并查看是否有任何项目提到了反向跟踪或类似的内容。

目前,使用像Datadog这样的其他跟踪器,不可能获取给定任何非起始点的完整请求的跟踪。

英文:

Is there a way to get the full trace request given a starting point from anywhere in the lifecycle of the trace?

Basically, if I have a middle point or an end point of a trace, can I use those points to obtain the full trace of a request?

I want to build a tracing service (in Golang) where the service can return the full trace of a request given that a user supplies a point/span at any time during the trace of the request.

I have tried searching and looking to see if any projects have mentioned backwards tracing or something similar to that.

Currently, with other tracers like Datadog, its not possible to get the trace of a full request given any starting point that is not the beginning.

答案1

得分: 1

在OpenTelemetry中,Trace ID是不可变的,并且旨在对整个逻辑请求保持相同(假设W3C Headers)。跟踪是一个有向无环图,这意味着可以通过找到所有具有相同Trace ID的跨度,然后按照它们的边(由跨度ID和父跨度ID字段确定)对它们进行排序来确定顺序。这意味着只要有所有的跨度可用,你就可以很容易地“回溯”-只需查找与你拥有的跨度具有相同Trace ID的所有内容,并创建图形。

英文:

In OpenTelemetry, the Trace ID is immutable and intended to be the same for the entire logical request (assuming W3C Headers). A trace is a directed acyclic graph, which means the ordering can be determined by finding all spans with the same trace ID and then sorting them by their edges (which would be determined by the span ID and parent span ID fields). This means that you can 'look back' very easily as long as you have all of the spans available - you just look for everything with the same trace ID as the span you have, and create the graph.

答案2

得分: 0

这取决于你记录了什么内容。如果你可以访问完整的原始日志,并且在每个服务器、客户端和中间件请求的开始处记录了完整的上下文,你可以尝试查找所有具有类似 traceID 的日志。再次强调,根据你的工具配置,你可能没有这个日志。

英文:

It depends on what you've logged. If you have access to the full raw logs, and you've logged the entire context at the beginning of every server, client, and middleware request, you can perhaps look for all the logs with a similar traceID in their context. Again, based on your instrumentation, you might not HAVE this log.

huangapple
  • 本文由 发表于 2022年3月29日 03:50:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/71652996.html
匿名

发表评论

匿名网友

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

确定