简体   繁体   English

如何从 stackdriver nodejs lib 获取当前跟踪 ID 和 span id

[英]How to get current trace id and span id from stackdriver nodejs lib

I am using @google-cloud/trace-agent library for nodejs for tracing.我正在使用 @google-cloud/trace-agent 库进行 nodejs 跟踪。 Once I start my tracer.一旦我启动了我的追踪器。 I am able to see the traces in stackdriver console.我能够在 stackdriver 控制台中看到跟踪。 Now I want to get the current traceId and spanId so that I can log it and map to my tracing data.现在我想获取当前的 traceId 和 spanId,以便我可以记录它并映射到我的跟踪数据。

I am unable to find the api that provides the current trace context.我无法找到提供当前跟踪上下文的 api。

我能够使用 getCurrentContextId() 方法实现这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM