Lesson content
Read, practise, then check your understanding
Observability: Monitoring and Logging
Stackdriver is the former brand for what is now Google Cloud Observability. The current suite includes Cloud Monitoring, Cloud Logging, Cloud Trace, Error Reporting, and related capabilities. Current vocabulary matters when learners search documentation or configure agents.
Core ideas
- Cloud Monitoring stores metrics and supports dashboards, uptime checks, service monitoring, and alert policies.
- Cloud Logging stores, searches, routes, and analyzes log entries.
- Log-based metrics convert matching logs into numeric series for visualization and alerting.
- The Ops Agent collects supported VM logs and metrics; OpenTelemetry supports portable application instrumentation.
Design and operating model
Define service-level indicators from user outcomes, emit structured logs with trace correlation, instrument latency and errors, create log sinks and retention from policy, and build actionable alert policies. Route central security logs to a protected project and restrict who can alter sinks.
Example
gcloud logging read \
'resource.type="cloud_run_revision" AND severity>=ERROR' \
--freshness=30m \
--limit=20 \
--format='table(timestamp,resource.labels.service_name,textPayload)'
gcloud monitoring policies list --format='table(displayName,enabled)'
Run examples in a disposable training project. Replace project IDs, Regions, identities, resource names, sizes, and policies with reviewed values, and verify current Google Cloud CLI and service requirements before production use.
Production guidance
- Avoid unbounded labels and high-cardinality metrics that increase cost and reduce usability.
- Give every alert an owner, severity, notification route, recovery condition, and runbook.
- Monitor telemetry ingestion, sinks, exclusions, agent health, retention, and alert delivery itself.
The chapter quiz follows the lesson and checks both service vocabulary and architecture decisions.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.