
Observability on Google Cloud is organized with Workspaces within the Cloud Monitoring service. These are dashboards that can be used to provide a “single pane of glass” to show what is happening in the whole system and give secure access to the information, some of which may be sensitive. Let’s take the skill service from the Skills Mapper project and show how you can add useful metrics about its resources using a Workspace.
Monitoring Workspaces
In Google Cloud, a Workspace resides within a project and inherits its name. While it’s tethered to one project, it can oversee resources from up to 100 different projects. For this chapter, you’ll set up a Workspace in the management project, but it will monitor resources from the citadel project.
You might wonder, “Why not create the workspace directly in the citadel project?” There’s a reason: if you were to ever remove the citadel project, especially if it’s a temporary setup, the Workspace would vanish with it, so this is a better option.
By placing your Workspace in a distinct project, you also gain flexibility. Multiple environments—be it dev, test, qa, or prod—can all be under the watchful eyes of a single Workspace. It aligns with the vision of an observatory: a unified vantage point to gaze across your entire digital cosmos.
Configuring Cloud Monitoring
The project that you are in—in this case, the management project—is monitored automatically. You can expand the metrics scope by adding additional projects. To add the Citadel project to the current project, set environment variables for the management and monitored project ID (e.g., skillsmapper-management and skillsmapper-development, respectively):
export
MANAGEMENT_PROJECT_ID
=[
MANAGEMENT_PROJECT_ID
]
export
MONITORED_PROJECT_ID
=[
MONITORED_PROJECT_ID
]
Make sure that your current project is the management project:
gcloud
config
set
project
$MANAGEMENT_PROJECT_ID
Just as Firebase emerged as a standalone product before its integration with Google Cloud, Google Cloud Monitoring similarly began its journey under a different identity: Stackdriver. Originally developed as an independent monitoring solution, Stackdriver was acquired by Google and subsequently integrated into the Google Cloud suite.
Because of this historical evolution, certain aspects of Google Cloud Monitoring still bear remnants of its Stackdriver roots, especially in the tools provided for users to interact with it. Notably, the gcloud CLI, which is the primary tool for managing Google Cloud resources, doesn’t fully encapsulate all the features of the monitoring service. Some of these commands, due to their transitional nature or a recent addition, are labeled as “beta,” indicating that they might not be as stable as other well-established commands or could undergo further changes in subsequent releases.