Google Cloud Platform – Stackdriver error reporting

How to set a static IP address on Windows Server 2019

Stackdriver error reporting aggregates and displays errors in your cloud services. Stackdriver error reporting works with Google App Engine and Google Cloud Functions, with beta versions available for Google Compute Engine and AWS EC2. All application errors can be captured by Stackdriver error reporting by logging application errors to Stackdriver logging:

Let’s learn more about Stackdriver error reporting by deploying a simple app on Google App Engine. We will then introduce and capture an error in the app.

In your main GCP console, go to your side bar menu and click on App Engine | Dashboard. Make sure you are in your desired project and billing is enabled. I am using the Stackdriver-test-project that we created earlier.

You will see a quick start guide on the right. Let’s follow that guide and deploy our Hello World app in a Python platform:

Click Continue for the quick-start guide:

Click Continue. Follow the instructions and clone the sample code in your cloudshell console. Make sure you remember or copy these commands; we will be introducing failures in the app once it’s deployed using the same commands.

If you followed the quick-start guide, you will have an app deployed that runs on Python and returns Hello World when you access its URL:

You will see the app we deployed listed in the Services tab under the App Engine pane:

Now that we have a running app, lets introduce an error. Open a new cloudshell, git clone the sample web app, and edit the main.py file. Change the import statement to import webapples.

Run this command:

gcloud app deploy app.yaml --project stackdriver-test-123
The gcloud command can be run from either CloudShell (that pops up in the GCP web console) or on your command line of your machine if GCP cloud SDK is installed. We will learn more about these two tools in greater detail in the upcoming chapters.

You will now see a new version of your app deployed:

You will also see two versions of the app:

Let’s click on the latest version, which is currently serving traffic:

Now that we have introduced an error, let’s visit Error Reporting in the STACKDRIVER menu:

You will see an error shown in the Error list:

Click on AUTO RELOAD; this causes the error list to refresh every five seconds:

Click on the error:

You will see occurrences, which shows how many times this error happened. The more times you access the web app’s URL, the more occurrences happen. Errors are grouped and deduplicated, so instead of seeing five errors of the same kind, you will see 500 Internal Server Error grouped as shown before.

Right below this dashboard, click on Recent samples, and you will see all the available details here. You will also see the line number and the file where the error happened:

Explore the UI a bit more and understand how you can easily identify errors in your deployed apps. Continue to run this faulty app, as we will try to fix it in the next section, using the Stackdriver debugger.

Comments are closed.