Spring Cloud Sleuth- 获取当前的 traceId? [英] Spring Cloud Sleuth- Get current traceId?

查看:182
本文介绍了Spring Cloud Sleuth- 获取当前的 traceId?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Sleuth,我想知道是否可以获取当前的 traceId?我不需要添加任何回复或任何东西.我只想要在某些情况下提醒开发团队的电子邮件的 traceId.

I am using Sleuth and I am wondering is it possible to get the current traceId? I dont need to add it any responses or anything. I just want the traceId for emails alerting the development team in certain situations.

推荐答案

注入 tracer bean 并调用 currentSpan() 获取当前 span.您可以从那里获取跟踪 ID.

Inject the tracer bean and call currentSpan() to get the current span. From there you can get the trace id.

这篇关于Spring Cloud Sleuth- 获取当前的 traceId?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆