flask - 使用 Flask 和请求的 OpenCensus 分布式跟踪传播
问题描述
我正在尝试通过 OpenCensus 跨不同的服务实现分布式跟踪,其中每个服务都使用 Flask 进行服务并使用...发送下游请求 requests
来构建它的回复。追踪平台是 GCP Cloud Trace。
我正在使用FlaskMiddleware
,它正确地跟踪初始调用,但源和目标服务之间没有跨度信息的传播,即使中间件定义了传播(我已经尝试了一些):
#middleware = FlaskMiddleware(app, exporter=exporter, sampler=sampler, excludelist_paths=['healthz', 'metrics'], propagator=google_cloud_format.GoogleCloudFormatPropagator())
middleware = FlaskMiddleware(app, exporter=exporter, sampler=sampler, excludelist_paths=['healthz', 'metrics'], propagator=b3_format.B3FormatPropagator())
#middleware = FlaskMiddleware(app, exporter=exporter, sampler=sampler, excludelist_paths=['healthz', 'metrics'], propagator=trace_context_http_header_format.TraceContextPropagator())
我想问题是,当每个服务通过 Flask 提供服务并通过requests
.
目前,我最终使每个服务都有自己的单一跨度跟踪。
解决方案
推荐阅读
- macos - 无法在 macOS 10.12 中导入 confluent_kafka?
- julia - 如何打印错误的完整堆栈跟踪?
- android - 在 playconsole 中取消挂起的发布
- java - 编写一个只有 1 个数组的 Java 快速排序函数
- python - 为什么我的 Python 装饰器有时是“str”类型的?
- google-apps-script - 返回 Google Apps 脚本中的字符串长度
- python-3.x - 将 Google Cloud Vision API 与手动填写的表单一起使用
- java - 我在解决这个 java 问题时遇到了麻烦。看看你能不能帮忙
- amazon-web-services - AWS 无法创建 Fargate 配置文件
- angular - 如何使用密钥将登录凭据加密为 base64