Observability
The Three Pillars of Observabilityβ
| Pillar | GCP Service | What It Answers |
|---|---|---|
| Metrics | Cloud Monitoring | Is the system healthy? How is it performing? |
| Logs | Cloud Logging | What happened, and when? |
| Traces | Cloud Trace | Where is the latency in a request? |
Cloud Profiler (CPU/memory profiling) and Error Reporting add depth beyond the three pillars.
Cloud Monitoringβ
Collects metrics from GCP services, VMs, Kubernetes, and custom applications. Key concepts:
- Metrics β time-series data (CPU utilisation, request count, latency). GCP services emit metrics automatically; custom metrics via the Monitoring API or OpenTelemetry.
- Dashboards β visualise metrics; pre-built dashboards for GCE, GKE, Cloud SQL, etc.
- Uptime checks β probe an HTTP/HTTPS/TCP endpoint at regular intervals; alert if it fails
- Managed Service for Prometheus β run Prometheus-compatible monitoring inside GKE without managing the Prometheus server
Cloud Loggingβ
Centralised log management for all GCP services and custom applications.
Log buckets β logs are stored in named buckets with configurable retention (1β3650 days). Default buckets: _Required (400-day retention, cannot be changed) and _Default (30-day retention, configurable).
Log sinks β export logs to other destinations:
- Cloud Storage β long-term archival
- BigQuery β SQL analysis over log data
- Pub/Sub β stream logs to external SIEM (Splunk, Datadog)
- Another log bucket β centralise logs across projects
Log-based metrics β create custom Monitoring metrics from log patterns (e.g. count of ERROR log entries per minute).
Log exclusion filters β reduce log ingestion costs by dropping high-volume, low-value logs before they are stored.
Docs: Cloud Logging overview
Cloud Traceβ
Distributed tracing service that tracks requests as they flow through microservices.
- Automatically instruments App Engine, Cloud Run, and Cloud Functions
- Manual instrumentation via OpenTelemetry SDK for other services
- Shows end-to-end latency breakdown per service call
- Identifies which service in a chain is causing tail latency
Docs: Cloud Trace overview
Cloud Profilerβ
Continuous CPU and memory profiling of production applications with minimal overhead (~0.5% CPU).
- Flame graphs show which functions consume the most CPU or allocate the most memory
- Supports Go, Java, Node.js, Python
- No restarts required β attaches to a running application
Docs: Cloud Profiler overview
Error Reportingβ
Aggregates and deduplicates application errors from Cloud Logging. Groups stack traces into error groups, shows occurrence count and affected users, and can alert on new errors.
Docs: Error Reporting overview
SLI, SLO, and SLAβ
| Term | Definition | Example |
|---|---|---|
| SLI (Service Level Indicator) | A measurable metric that quantifies reliability | 99th-percentile latency; request success rate |
| SLO (Service Level Objective) | The target value or range for an SLI | 99.9% of requests succeed; p99 latency < 500ms |
| SLA (Service Level Agreement) | A contractual commitment; breach triggers penalties | Customer receives a credit if monthly uptime < 99.9% |
| Error budget | The allowed failure headroom implied by the SLO | At 99.9% SLO, you have 43.8 min/month of allowed downtime |
Error budgets drive engineering decisions:
- Error budget healthy β can take risks (deploy more often, run experiments)
- Error budget depleted β freeze risky changes; prioritise reliability work
Alertingβ
Alert policies define the condition (metric threshold, log match) and the notification channel (email, PagerDuty, Pub/Sub, Slack).
Burn rate alerts β instead of alerting when SLO is breached (too late), alert when error budget is being consumed faster than expected:
- A burn rate of 1 = consuming budget at exactly the sustainable rate
- A burn rate of 14.4 over 1 hour = budget depleted in 5 days β page immediately
- Common pattern: fast burn (1h window, high multiplier) + slow burn (6h window, lower multiplier)
Exam Tipsβ
- "Unified observability across GCP and on-premises Prometheus" β Managed Service for Prometheus
- "Export logs to an external SIEM" β Log sink β Pub/Sub β SIEM (not a direct integration)
- "Alert before the SLO is breached" β burn rate alert, not threshold on the SLI metric
- "Analyse logs with SQL" β Log sink β BigQuery
- Cloud Trace is for latency (where is the slowness?); Cloud Profiler is for resource usage (what is consuming CPU/memory?)