Google Cloud Platform – Stackdriver Trace

How to Create Swap File on Ubuntu 19.10 & 19.04

Stackdriver Trace is a distributed tracing system that collects latency data from applications, Google App Engine, and HTTP(s) load balancers, and displays it in near-real time in the GCP console. For applications to be able to use this feature, they need to have the appropriate code in place with the Stackdriver Trace SDKs, but this is not needed if your application is being deployed in Google App Engine. Stackdriver Trace greatly enhances your understanding of how your application behaves. Things like time to handle requests and complete RPC calls can be viewed in real time using Stackdriver Trace:

Some use cases for Stackdriver Trace include the following:

  • Reviewing historical latency data
  • Reviewing detailed latency data, including performance insights and RPC calls
  • Generating custom reports for latency data, and building comparison models for latency data

As mentioned before, Stackdriver Trace is tightly integrated with Google App Engine, so any application you deploy in the app engine can be traced using Stackdriver Trace. During runtime, app engine sends latency data to Stackdriver Trace for requests for the application URIs and for round-trip RPC calls. Stackdriver Trace does not work with Cloud SQL.

Let’s explore the dashboard to understand Stackdriver Trace. On your side menu tab, go to Stackdriver and click on Trace | Overview:

You will see an Overview dashboard similar to the following:

Click on Trace list to view recent requests to your application:

I am using the web app we deployed in the beginning of this chapter. You can see Stackdriver Trace is picking up the requests to the URI.

You can click on a specific request to get more information:

Clicking on the first request gives you the timeline for the request:

You can create an analysis report for your traced data.

Click on the Analysis  reports option:

Click on NEW REPORT to create a new report:

For the Request URI, we have a /, which indicates that this report must contain information for all requests made to the application.

If you get this message, it means that you have too few traces to create a meaningful report:

Once the report is generated, you can access it by clicking on Analysis, and here is what a sample report will look like:

This is a powerful tool to use in your environment to better understand the behavior of your code and your application. It is important to remember that for an app that is running in a virtual machine or a container, Stackdriver Trace is not automatically enabled or traced. This is also the case for apps running in the GCP App Engine flexible environment. You will need to use libraries or the Stackdriver Trace API to send traces to the service. You can enable or set up Stackdriver Trace for platforms such as C#, Java, Go, Node.js, Ruby, and PHP.

Comments are closed.