本文介绍了如何通过端到端的微服务链跟踪请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Go中使用OpenCensus将跟踪数据推送到Stackdriver,以进行涉及两个或多个微服务链的调用,并且我注意到我得到了很多跟踪,这些跟踪仅包含某些服务的跨度,而不包含整个端到端调用.

I am using OpenCensus in Go to push tracing data to Stackdriver for calls involving a chain of 2 or more micro services and I noticed that I get many traces which contain spans only for certain services but not the entire end to end call.

此刻,我将其归因于并非所有呼叫都被跟踪(仅特定样本),并且每个服务都决定是否跟踪其当前跨度.

At the moment I attribute this to the fact that not all calls are traced (only a certain sample) and each service decides whether to trace its current span or not.

这是预期的工作方式吗?有什么方法可以确保何时对跟踪进行采样,而调用链中的所有服务都可以对采样进行采样?

Is this the way it is intended to work? Is there any way to make sure when a trace is sampled, it is done so by all services in the call chain?

推荐答案

我会说,在开发微服务时,请确保您的API网关创建一个唯一的ID(如GUID),该ID会在所有微服务中传播.同样,您要确保您拥有日志汇总器,该日志汇总器将从所有服务和服务中收集日志.最终,您将获得很好的请求可追溯性.

Architecturally I will say when you are developing your microservices make sure your API Gateway creates a unique id like GUID, which gets propagated through all the microservices & similarly you make sure that you have log aggregator which will be collecting logs from all the services & finally you are getting nice tracebility of request.

这篇关于如何通过端到端的微服务链跟踪请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 07:55