trace-nodejs | Trace is a visualised distributed tracing platform | Microservice library
kandi X-RAY | trace-nodejs Summary
kandi X-RAY | trace-nodejs Summary
App | Documentation | Status page | Case study.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of trace-nodejs
trace-nodejs Key Features
trace-nodejs Examples and Code Snippets
Community Discussions
Trending Discussions on trace-nodejs
QUESTION
I have been diving into a Stackdriver Trace integration on Google Cloud Run. I can get it to work with the agent, but I am bothered by a few questions.
Given that- The Stackdriver agent aggregates traces in a small buffer and sends them periodically.
- CPU access is restricted when a Cloud Run service is not handling a request.
- There is no shutdown hook for Cloud Run services; you can't clear the buffer before shutdown: the container just gets a SIGKILL. This is a signal you can't catch from your application.
- Running a background process that sends information outside of the request-response cycle seems to violate the Knative Container Runtime contract
- The collections of logging data is documented and does not require me to run an agent, but there is no such solution for telemetry.
- I found one report of someone experiencing lost traces on Cloud Run using the agent-based approach
I went into the source code for the Cloud Endpoints ESP, (the Cloud Run integration is in beta) to see if they solve it in a different way, but there the same pattern is used: there is a buffer with traces (1s) and it is cleared periodically.
QuestionWhile my tracing integration seems to work in my test setup, I am worried about incomplete and missing traces when I run this in a production environment.
Is this a hypothetical problem or a real issue?
It looks like the right way to approach this is to write telemetry to logs, instead of using an agent process. Is that supported with Stackdriver Trace?
ANSWER
Answered 2019-Dec-03 at 23:05You're right. This is a fair concern since most tracing libraries tend to sample/upload trace spans in the background.
Since (1) your CPU is nearly scaled nearly to zero when the container isn't handling any requests and (2) the container instance can be killed any time due to inactivity, you cannot reliably upload those trace spans collected in your app. As you said, it may sometimes work since we don't fully stop CPU, but it won't always work.
It appears like some of the Stackdriver (and/or OpenTelemetry f.k.a. OpenCensus) libraries let you control the lifecycle of pushing trace spans.
For example, this Go package for OpenCensus Stackdriver exporter has a Flush()
method that you can call before completing your request rather than relying on the runtime to periodically upload the trace spans: https://godoc.org/contrib.go.opencensus.io/exporter/stackdriver#Exporter.Flush
I assume other tracing libraries in other languages also expose similar Flush() methods, if not, please let me know in the comments and this would be a valid feature request to those libraries.
QUESTION
I have activated Google Cloud Tracer with nodejs & express, works well in automatic mode, registers calls to the api correctly.
I try to create a trace manually, to know the execution time of intermediate steps.
...ANSWER
Answered 2018-Nov-05 at 17:59If you have automatic tracing enabled and also generate root spans within a request listener using the custom span API, then the root span will be ignored because it was created within a pre-existing root span (the one that was automatically started for this request). This is my guess based on the code presented here, but you should be able to accomplish what you want by instead creating a child span. (Custom root spans are meant for work that occur outside of a request's lifecycle -- such as periodic work.)
Re: Express.js middleware context -- I am not exactly sure what you mean here, but the Trace Agent doesn't store any of the request listener arguments in the trace context.
As an additional note -- you'll get a quicker response time if you report an issue directly to the GitHub repository to which you linked.
Hope this helps!
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install trace-nodejs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page