
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create Cloud PubSub Topic and Configure Subscription
/ 50
Deploy and Create Sink for Cloud Run Service
/ 50
This lab was developed with our partner, Datadog. Your personal information may be shared with Datadog, the lab sponsor, if you have opted-in to receive product updates, announcements, and offers in your Account Profile.
Datadog is a monitoring and analytics platform for cloud-based applications, infrastructure, and networks. It provides real-time visibility into application performance, infrastructure health, and user experience.
The Datadog integration for Google Cloud Platform is a powerful way to get data into Datadog with minimal effort. It is agentless and pulls metadata at the Platform level from Google Cloud APIs. In addition, the new Datadog Cloud Run agent delivers official support for traces and custom metrics in managed Cloud Run instances.
In this lab, you'll explore how to connect Datadog to your Google Cloud project, and use it to monitor a Cloud Run app. You'll also explore the new APM/tracing capabilities offered by the new Datadog Cloud Run agent.
You will learn how to:
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This Qwiklabs hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab.
Note: If you are using a Pixelbook, open an Incognito window to run this lab.
Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is a panel populated with the temporary credentials that you must use for this lab.
Copy the username, and then click Open Google Console. The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Open the tabs in separate windows, side-by-side.
In the Sign in page, paste the username that you copied from the Connection Details panel. Then copy and paste the password.
Important: You must use the credentials from the Connection Details panel. Do not use your Qwiklabs credentials. If you have your own Google Cloud account, do not use it for this lab (avoids incurring charges).
Click through the subsequent pages:
After a few moments, the Cloud Console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
In the Cloud Console, in the top right toolbar, click the Activate Cloud Shell button.
Click Continue.
It takes a few moments to provision and connect to the environment. When you are connected, you are already authenticated, and the project is set to your PROJECT_ID. For example:
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
You can list the active account name with this command:
(Output)
(Example output)
You can list the project ID with this command:
(Output)
(Example output)
If you already have a trial account set up, you can use that. It is recommended that you do not use your production Datadog account to avoid cluttering the environment with test and training assets.
Navigate to https://us5.datadoghq.com/signup and enter your name, email, company, and a password.
Next, select your software stack. For this lab, you will be using Google Cloud Platform. Click Next.
Navigate to https://us5.datadoghq.com/organization-settings/api-keys Use the Copy Key button as shown to copy your API Key to your clipboard.
Back in the Cloud Console, navigate back to your Cloud Shell window. Run the following command, replacing <YOUR_DATADOG_API_KEY>
with your API key in the appropriate slot:
With Google Cloud, nothing is enabled by default to protect you from using a costly system by accident. Run the following in Cloud Shell to enable all the APIs needed for this lab:
To use Datadog to monitor a project, you need to enable APIs needed for Datadog, create a service account, and connect the service account to Datadog.
Datadog's Google Cloud integration uses a service account to make calls to the Cloud Logging API to collect node-level metrics from your Compute Engine instances.
In Datadog, navigate to Integrations, search for Google Cloud Platform and select it.
Click on Add GCP Account. If you have no configured projects, you are automatically redirected to this page.
If you have not generated a Datadog principal for your org, click the Generate Principal button.
Copy your Datadog principal to the clipboard and keep it for the next section.
Back in the Google Cloud console, under the Service Acounts menu, find the service account you created in the first section.
Go to the Permissions tab and click on Grant Access.
Paste your Datadog principal into the New principals text box.
Assign the role of Service Account Token Creator and click Save.
In your Google Cloud console, navigate to the Service Account > Details tab for the service account you created. There, you can find the email associated with this Google service account. It resembles <sa-name>@<project-id>.iam.gserviceaccount.com
. Copy this email.
Return to the integration configuration tile in Datadog (where you copied your Datadog principal in the previous section).
In the box under Add Service Account Email, paste the email you previously copied.
Click on Verify and Save Account.
export-logs-to-datadog
(make sure to use this exact name for proper assessment.in this lab) and Save. The default options are fine. Make sure Add a default subscription is checked.Go back to the Cloud Pub/Sub console in Google Cloud, and select Subscriptions in the left-hand navigation.
Create a subscription ID by selecting Create Subscription. Give it an appropriate name and select the topic you previously created (export-logs-to-datadog
).
Change the method to Push. For the endpoint, enter the following (make sure to replace the Datadog API key in this string): https://gcp-intake.logs.us5.datadoghq.com/api/v2/logs?dd-api-key=<DD_API_KEY>&dd-protocol=gcp
. Do NOT enable authentication.
Hit Create at the bottom.
🎉 The Cloud Pub/Sub is ready to receive logs from Google Cloud Logging and forward them to Datadog.
Click Check my progress to verify the objective.
First, Clone the repo with a sample app:
Next, set the repository name variable:
Create a Google Cloud Artifact Registry repository:
After that, build the Docker image:
Nearly done! Now push the Docker image to Google Cloud Artifact Registry:
Finally, deploy to Google Cloud Run:
If you get a message that says Allow unauthenticated invocations to [cloud-run-demo-go] (y/N)?
, it probably means you typed something wrong or the command wasn't copied properly. Ctrl-C and try again.
When this completes, you should see the URL for your running app:
It's very important that you now click the URL and visit the page to generate some traces! Refresh the page a few times for good measure.
Go to the Google Cloud Logging page and filter by Cloud Run Revision logs.
Click Create Sink (in the "More Actions" menu)and name the sink datadog-cloudrun
(use this name exactly for proper assessment)
Choose “Cloud Pub/Sub” as the destination and select the Pub/Sub that was created for that purpose.
In step 3, make sure the inclusion filter is resource.type="cloud_run_revision"
Click Create Sink and wait for the confirmation message to show up.
🎉 Nice work! The Cloud Run app should now be running and sending metrics to Datadog.
Click Check my progress to verify the objective.
Head over to your Datadog console. If you go to APM > Traces, you should see some traces from your Cloud Run app!
You can click on a trace to see more details:
Head over to your Datadog console. If you go to Infrastructure > Serverless, you should see all of available metrics about your Cloud Run app!
You should also be able to head over to Logs in the Datadog console, select a log, and get more context.
In this lab, you got hands-on experience using Datadog's new Google Cloud Run integration and Datadog's Google Cloud Platform-level integration which makes monitoring your workloads easy!
Be sure to check out the following labs for more practice with Datadog:
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one