Stackdriver Trace is a distributed tracing system for Google Cloud Platform that collects latency data from Google App Engine, Google HTTP(S) load balancers, and applications instrumented with the Stackdriver Trace SDKs, and displays it in near real time in the Google Cloud Platform Console. It helps you understand how long it takes your application to handle incoming requests from users or other applications, and how long it takes to complete operations like RPC calls performed when handling the requests. Currently, Stackdriver Trace collects end-to-end latency data for requests to App Engine URIs and additional data for round-trip RPC calls to App Engine services like Datastore, URL Fetch, and Memcache.
As micro-services become more popular, the cross-application tracing provided by Stackdriver Trace becomes essential in pinpointing the root cause of latency issues.
You can use Stackdriver Trace to:
- Quickly view a snapshot of last-day latency data for your application in the trace overview.
- Drill down to detailed latency data, including performance insights and detailed data for the most frequent application requests and RPC calls.
- Find latency data for individual requests and view latency details.
- Generate custom analysis reports that show an overview of latency data for all or a subset or requests, and allow you to compare two different sets of latency data.
Why Stackdriver Trace?
Latency management — managing the amount of time it takes for your application to handle incoming requests and perform operations — is an important part of managing overall application performance. Stackdriver Trace helps you monitor application latency, identify its sources, and optimize your application based on the data it collects.
Because Stackdriver Trace is tightly integrated with Google App Engine, it provides a high level of coverage and fidelity when collecting latency data from your applications. It also provides built-in, automatic analysis reporting that makes it easier to understand application latency and bottlenecks, and how these impact overall performance.
Stackdriver Trace can help you answer the following questions:
- How long does it take my application to handle a given request?
- Why is it taking my application so long to handle a request?
- Why do some of my requests take longer than others?
- What is the overall latency of requests to my application?
- Has latency for my application increased or decreased over time?
- What can I do to reduce application latency?
How does Stackdriver Trace work?
Stackdriver Trace works for any running App Engine application. During application runtime, App Engine sends latency data to Stackdriver Trace for requests to application URIs and, within the requests, for round-trip RPC calls to App Engine services. Stackdriver Trace works with all App Engine APIs, with the exception of Cloud SQL.
App Engine sends latency data to the Stackdriver Trace backends in the form of a trace. The trace consists of a root span that contains overall latency information about the request, as well as subspans that contain latency information about any completed RPC calls. Each span contains a set of properties that provide information about the source and amount of latency.
Stackdriver Trace stores the incoming latency data in its storage backends, and makes it available for real-time viewing and reporting in the Cloud Platform Console.
A trace charts an incoming request to your application and the various events (typically RPC calls or instrumented sections of code) that took place in order to generate a response to the request, along with precise timings. These events are represented as spans in the trace.
A component that of a trace which typically represents an RPC call that took place as a result of the initial request to the application.
Metadata attached to a particular span. Common examples include the version of the service on which the span is executed, data related to generator of a captured RPC call (such as the user agent of a calling web browser on the root span of a trace), or custom data that the developer chose to include with a span. Some of these values can be filtered on in the Stackdriver Trace UI or via the analysis tools.