This sample shows how to integrate Stackdriver with your smart home service in order to process and triage errors that originate when your service sends an invalid response to the Google Assistant.
In this sample, you are able to simulate many common errors that may be in a smart home response. You can view these errors in graphs and reports.
- Follow the instructions to set up and initialize the Firebase SDK
- Setup Cloud Functions, Hosting, and Firestore
cd functions && yarn && cd ..
cd public && yarn
yarn firebase-setup
yarn build
- Run
firebase deploy
and take note of the hosting URL. It should look like:<project-id>.firebaseapp.com
-
Open the Google Cloud Console and go to APIs & Services
- Under Credentials > Domain Verification add your domain.
- After adding your domain you will be taken to the Google Search console. Follow the instructions there to finish verifying your website before proceeding.
- You will download a verification webpage. Add this file to the
public
directory.
-
Run
firebase deploy
to upload this new verification file
To start exporting your errors, go to Logging > Logs
- Create a new Export
- Give it a name like smarthome-error
- Select Cloud Pub/Sub as the Sink Service
- Create a new Cloud Pub/Sub topic
- Go to Logging > Exports, find the export you just created, and select Edit sink
- Update the filter for your service to be:
severity>=ERROR
("SYNC")
- Click Update Sink and replace your existing sink.
- Go to Pub/Sub > Topics
- You'll see your topic has already been created.
- Select your topic and create a new subscription
- Give your subscription a name
- Choose the Push delivery type and enter the endpoint:
<project-id>.firebaseapp.com/alerts/stackdriver
- Select Save
Now you are ready to triage errors to your server.
- Open
<project-id>.firebaseapp.com
in a web browser- You can use the dropdowns to change the validity of certain parameters
- You can use the SYNC button to generate invalid responses
- You'll see these errors get displayed on the page
- Your function will also be executed with the error from Stackdriver
- The Firestore instance will be updated, and you'll see the graphs change