tracking span id with @google-cloud/logging-winston and Cloud Trace

371 views
Skip to first unread message

Dan Doyle

unread,
May 20, 2021, 3:26:18 PM5/20/21
to Google Stackdriver Discussion Forum
I use LoggingWinston with nodejs Cloud functions. LoggingWinston does not add a LogEntry for span_id when used with Cloud Trace. I created a shim that adds this.  I have been using this technique for the last 2 years and I was hoping that it would be added at some point but I am not seeing any new tracking for span_id in latest LoggingWinston.

I am not sure if I am misguided with this approach or if this is something that could be handy. If misguided, I could use some direction as to how I should be thinking about spans and traces or if there is another best practice/preferred technique for tracking activity though Cloud Functions that can be used with Cloud Trace.

If the shim is of interest, I could work on submitting a PR to @google-cloud/logging-winston to be included. I would like to get rid of my shim preferring a library that handles this for me.

Igor Peshansky

unread,
May 20, 2021, 3:35:02 PM5/20/21
to Dan Doyle, Simon Zeltser, Google Stackdriver Discussion Forum
Dan, +Simon Zeltser may be able to point you at where this is tracked publicly, and discuss how you can contribute.
        Igor

--
© 2021 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.
---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-stackdriver-discussion/06179d51-f71e-4f0c-b122-2aa907e06acen%40googlegroups.com.

Simon Zeltser

unread,
May 20, 2021, 5:46:42 PM5/20/21
to Igor Peshansky, Nicole Zhu, Dan Doyle, Google Stackdriver Discussion Forum
+Nicole Zhu 

Hey Dan,

We are working these days on enabling structured logging on GCE/GKE/Cloud Functions/Cloud Run/AppEngine in all logging libraries supported by Google Cloud, including nodejs-logging-winston. Nicole is leading the implementation in nodejs. Tracking for this effort is happening internally. As part of this work, we add resource-autodetection for Cloud Functions, populating severity, trace and span_id fields of LogEntry.
Our goal is to ship it towards the end of Q3.
We didn't get to the winston adapter yet. I encourage you to open an issue on the repo with your proposal for implementation. We would gladly accept community contributions.

Thanks,
Simon

Dan Doyle

unread,
May 20, 2021, 8:30:30 PM5/20/21
to Simon Zeltser, Igor Peshansky, Nicole Zhu, Google Stackdriver Discussion Forum
Right on!

I will investigate opening an issue on the repo this weekend.

Dan

From: Simon Zeltser <zel...@google.com>
Sent: Thursday, May 20, 2021 3:46 PM
To: Igor Peshansky <ig...@google.com>; Nicole Zhu <nico...@google.com>
Cc: Dan Doyle <d...@sproutward.com>; Google Stackdriver Discussion Forum <google-stackdr...@googlegroups.com>
Subject: Re: [google-stackdriver-discussion] tracking span id with @google-cloud/logging-winston and Cloud Trace
 
CAUTION: This email originated from outside organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Igor Peshansky

unread,
Jun 11, 2021, 1:36:50 PM6/11/21
to Dan Doyle, Nicole Zhu, Simon Zeltser, Google Stackdriver Discussion Forum
Great, please let us know how it goes.
CC +Google Stackdriver Discussion Forum again, for visibility.
        Igor

On Fri, Jun 11, 2021 at 12:18 PM Dan Doyle <d...@sproutward.com> wrote:
Thanks, Nicole. I will test it out when I get a chance.

Dan

From: Nicole Zhu <nico...@google.com>
Sent: Thursday, June 10, 2021 8:07 PM
To: Dan Doyle <d...@sproutward.com>
Cc: Simon Zeltser <zel...@google.com>; Igor Peshansky <ig...@google.com>

Subject: Re: [google-stackdriver-discussion] tracking span id with @google-cloud/logging-winston and Cloud Trace
CAUTION: This email originated from outside organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Update:
Approved PR in here: https://github.com/googleapis/nodejs-logging-winston/pull/599
Just pending this release - should be out by Monday or Tuesday latest.


On Thu, May 20, 2021 at 9:43 PM Nicole Zhu <nico...@google.com> wrote:
Hi Dan, et al, 

I'll get in span & trace in nodejs-logging (which will propagate to logging-winston) by the end of this quarter. There's a macro issue tracking it here and here.  But feel free to create a separate issue with more detail as well :). 

The implementation will look like what I did for Go here

Reply all
Reply to author
Forward
0 new messages