RousselTMLEARNING

Cloud computing

Observability on Google Cloud: Cloud Monitoring, Logging, Trace, Profiler and Managed Prometheus

A complete overview of Google Cloud Observability: Cloud Monitoring, Cloud Logging (router, sinks, Log Analytics), Cloud Trace, Cloud Profiler, Error Reporting, Managed Service for Prometheus, Ops Agent, Google's OpenTelemetry collector and OTLP API, supported pillars and integrations with Splunk, Datadog, Elastic or Grafana.

1. Overview #

The Google Cloud Observability suite.

The services in the suite #

Google Cloud Observability (formerly Stackdriver, then operations suite) brings together Cloud Monitoring, Cloud Logging, Cloud Trace, Cloud Profiler and Error Reporting, as well as Google Cloud Managed Service for Prometheus, built on Monarch, Google's internal time series database. Metrics for most managed services are collected automatically; platform logs and audit logs arrive in Cloud Logging with no configuration.

Google Cloud Observability architecture
On the left the data producers, in the center the Google Cloud Observability services, on the right the external tools. The components outlined in orange (alerts, query APIs, log sinks) are the only openings to the outside.

Supported pillars #

PillarServiceExplorationOpenTelemetry
MetricsCloud Monitoring, Managed Service for PrometheusMetrics Explorer, PromQL✅ Yes
LogsCloud Logging (buckets, Log Analytics)Logging query language, SQL (BigQuery)✅ Yes (collector, Ops Agent)
TracesCloud TraceTrace Explorer✅ Yes (OTLP through the Telemetry API)
ProfilesCloud Profiler (Go, Java, Node.js, Python)Flame graphs, comparisons🟡 Partial (Google-specific Profiler agent)
ErrorsError ReportingException grouping🟡 Partial
SyntheticUptime checks, synthetic monitorsCloud Monitoring🟡 Partial
Good to know: Google Cloud is one of the few clouds to natively offer all four pillars, profiles included, with Cloud Profiler and its low production overhead.

2. The components in detail #

Role of each service.

Cloud Monitoring #

Cloud Monitoring stores system and custom metrics, and offers the Metrics Explorer, dashboards, uptime checks and synthetic monitors, alerting policies (legacy MQL, PromQL now recommended) and SLO monitoring with error budgets and burn rate alerts. Scoping projects (metrics scopes) group metrics from several projects.

gcloud monitoring uptime create api-boutique \
  --resource-type=uptime-url --resource-labels=host=api.exemple.fr,project_id=boutique-prod \
  --path=/healthz --period=1

Cloud Logging #

All logs go through the log router: sinks send them to log buckets (configurable retention), BigQuery, Cloud Storage or Pub/Sub; exclusion filters avoid ingesting what is useless. Log Analytics lets you query upgraded buckets in SQL, with linked BigQuery datasets. Log-based metrics turn patterns into alerting metrics.

gcloud logging sinks create vers-bigquery \
  bigquery.googleapis.com/projects/boutique-prod/datasets/journaux \
  --log-filter='resource.type="cloud_run_revision" AND severity>=WARNING' --use-partitioned-tables

Cloud Trace, Cloud Profiler and Error Reporting #

Cloud Trace stores and analyzes spans (latency, call map, reports). Cloud Profiler continuously collects CPU and memory profiles with very low overhead and compares versions. Error Reporting automatically groups exceptions detected in logs and notifies about new errors.

Ops Agent and collection on Kubernetes #

On Compute Engine, the Ops Agent (based on Fluent Bit for logs and the OpenTelemetry Collector for metrics) collects system metrics and logs, with third-party integrations (NGINX, PostgreSQL…). On GKE, collection of logs and system metrics is built in, and Managed Prometheus collects application metrics with PodMonitoring resources.

apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata: { name: api, namespace: boutique }
spec:
  selector: { matchLabels: { app: api } }
  endpoints:
  - port: metrics
    interval: 30s

3. Detailed sheet for each component #

Role, content, data types, retention and internal and external interactions of each building block in the diagram.

Summary view #

The following table summarizes each component of the architecture diagram; the sheets that follow detail them one by one.

ComponentZoneSignalsCan be opened to the outside
Google OpenTelemetry CollectorCollectionMetrics, traces, logs🔒 No (internal)
Ops AgentCollectionSystem metrics, logs🔒 No (internal)
Cloud MonitoringStorageMetrics, SLOs🟡 Indirectly
Managed Service for PrometheusStoragePrometheus metrics🟡 Indirectly
Cloud LoggingStorageLogs, audit🟡 Indirectly
Cloud TraceStorageTraces🟡 Indirectly
Cloud ProfilerStorageProfiles🔒 No (internal)
Error ReportingAnalysisErrors🔒 No (internal)
Alerts and notification channelsOutputEvents🟠 Yes
Query APIsOutputAll🟠 Yes
Log sinksOutputStreamed logs🟠 Yes
Indicative values: Retention periods, limits and pricing models change regularly: check them in the official documentation before sizing an architecture.

Google-Built OpenTelemetry Collector #

The distribution of the OpenTelemetry Collector published and supported by Google.

CharacteristicDetail
RoleReceive OpenTelemetry telemetry from applications and send it to Google Cloud Observability services.
ContentOTLP and Prometheus receivers, processors (batching, GCP resource detection, filtering), googlecloud and googlemanagedprometheus exporters, OTLP export to the Telemetry API.
Data typeOTLP (traces, metrics, logs), Prometheus metrics.
Storage and retentionNone: send queues.
Inputs (internal components)Instrumented applications on GKE, Compute Engine, Cloud Run or outside Google Cloud.
Outputs (internal components)Cloud Trace, Managed Service for Prometheus, Cloud Logging, Cloud Monitoring.
External interactionsCan duplicate data to a third-party OTLP back end.
Can be opened to the outside🔒 No (internal)
Security and accessService account (Workload Identity on GKE) with write roles (Monitoring Metric Writer, Logs Writer, Cloud Trace Agent).
CostFree; you pay for hosting and ingestion.

Ops Agent #

The Compute Engine agent that combines Fluent Bit (logs) and the OpenTelemetry Collector (metrics).

CharacteristicDetail
RoleCollect system and application metrics and logs from VMs.
Content/etc/google-cloud-ops-agent/config.yaml file; third-party integrations (NGINX, Apache, PostgreSQL, MySQL, Redis…); deployment through VM Manager policies.
Data typeMetrics (CPU, memory, disk, network, processes), system and application logs.
Storage and retentionNone: local buffer.
Inputs (internal components)Compute Engine VMs (and servers outside Google Cloud with suitable configuration).
Outputs (internal components)Cloud Monitoring, Cloud Logging.
External interactionsNone directly.
Can be opened to the outside🔒 No (internal)
Security and accessVM service account with Logs Writer and Monitoring Metric Writer roles.
CostFree; ingestion billed.

Cloud Monitoring #

Google Cloud's metrics, dashboards, uptime checks and SLO service, backed by Monarch.

CharacteristicDetail
RoleStore and query metrics, drive alerts and SLOs, group projects in a metrics scope.
ContentGoogle Cloud system metrics, agent, custom, log-based and Prometheus metrics; Metrics Explorer; dashboards; uptime checks and synthetic monitors; SLO monitoring.
Data typeTime series (gauge, delta, cumulative kinds; integer, double, distribution values).
Storage and retentionData kept 24 months (6 weeks for some high-resolution metrics depending on the type).
Inputs (internal components)Google Cloud services (automatic), Ops Agent, OpenTelemetry Collector, Managed Prometheus, log-based metrics.
Outputs (internal components)Alerting policies, dashboards, SLOs.
External interactionsRead by Grafana (Google Cloud Monitoring data source), Datadog, Dynatrace, New Relic through the API.
Can be opened to the outside🟡 Indirectly: through the Cloud Monitoring API and the Prometheus API.
Security and accessIAM (Monitoring Viewer, Editor, Metric Writer); multi-project metrics scopes.
CostGoogle Cloud metrics free; custom and agent metrics by ingested volume; read API calls.

Google Cloud Managed Service for Prometheus #

A managed, global Prometheus, stored in Monarch.

CharacteristicDetail
RoleCollect and store Prometheus metrics at scale and query them in PromQL across all projects.
ContentManaged collection (PodMonitoring, ClusterPodMonitoring), self-deployed collection (drop-in Prometheus binary), rule evaluator, Prometheus-compatible query frontend.
Data typePrometheus time series.
Storage and retention24 months, like Cloud Monitoring.
Inputs (internal components)Managed collection on GKE, self-deployed Prometheus, OpenTelemetry Collector (googlemanagedprometheus).
Outputs (internal components)Cloud Monitoring (explorer, PromQL alerts), Prometheus API.
External interactionsGrafana and any PromQL tool through the Prometheus HTTP API.
Can be opened to the outside🟡 Indirectly: through the PromQL API.
Security and accessMonitoring IAM; service account for the query frontend.
CostBy number of ingested samples.

Cloud Logging #

Google Cloud's logging service, organized around the log router.

CharacteristicDetail
RoleReceive, route, store and analyze logs, including audit logs.
ContentLog router, sinks, exclusion filters, log buckets, Log Analytics (SQL through BigQuery), log-based metrics, Logging query language.
Data typeStructured log entries (LogEntry: resource, severity, text or JSON payload, trace); audit logs (admin activity, data access, system events, policy denied).
Storage and retention_Required bucket: 400 days (admin audit, not modifiable, free); _Default bucket: 30 days; custom buckets from 1 day to 10 years.
Inputs (internal components)Google Cloud services (automatic), Ops Agent, OpenTelemetry Collector, Logging API, GKE.
Outputs (internal components)Buckets, log-based metrics, Error Reporting, log-based alerts.
External interactionsSinks to Pub/Sub, BigQuery, Cloud Storage; read API.
Can be opened to the outside🟡 Indirectly: through sinks and the API.
Security and accessIAM (Logs Viewer, Private Logs Viewer for data access); log views per bucket.
CostIngestion beyond the free quota, storage beyond 30 days.

Cloud Trace #

Google Cloud's distributed tracing service.

CharacteristicDetail
RoleStore spans, analyze request latency and dependencies.
ContentTrace Explorer, latency reports, links with logs (trace field of log entries).
Data typeTraces and spans (OTLP accepted by the Telemetry API).
Storage and retentionKept 30 days.
Inputs (internal components)OpenTelemetry Collector, OpenTelemetry SDKs, instrumented services (Cloud Run, App Engine).
Outputs (internal components)Console, correlation with Cloud Logging.
External interactionsTraces can be duplicated to a third-party APM by the collector.
Can be opened to the outside🟡 Indirectly: through the Cloud Trace API.
Security and accessIAM (Cloud Trace Agent to write, User to read).
CostBy number of spans ingested beyond the free quota.

Cloud Profiler #

Google Cloud's continuous production profiling.

CharacteristicDetail
RoleContinuously measure where code spends CPU and memory and compare versions.
ContentCPU, heap, threads, contention and wall-time profiles depending on the language; flame graphs; comparisons.
Data typeProfiles (pprof format).
Storage and retentionProfiles kept 30 days.
Inputs (internal components)Profiler agent embedded in the application (Go, Java, Node.js, Python).
Outputs (internal components)Cloud Profiler console.
External interactionsNo native integration; third-party tools use their own profiling (Pyroscope…).
Can be opened to the outside🔒 No (internal)
Security and accessIAM (Cloud Profiler Agent, User).
CostNo additional charge.

Error Reporting #

Automatic grouping of application exceptions.

CharacteristicDetail
RoleDetect, group and track errors from logs and notify about new errors.
ContentError groups, occurrences, stack traces, status (open, acknowledged, resolved), notifications.
Data typeExceptions extracted from logs (stack traces).
Storage and retentionDepends on the underlying logs.
Inputs (internal components)Cloud Logging.
Outputs (internal components)Notifications to the configured channels.
External interactionsNone directly.
Can be opened to the outside🔒 No (internal)
Security and accessIAM (Error Reporting Viewer, User).
CostNo additional charge (cost of the logs).

Alerts and notification channels #

Cloud Monitoring's alerting engine.

CharacteristicDetail
RoleEvaluate conditions on metrics, SLOs or logs and notify.
ContentAlerting policies (threshold, metric absence, PromQL, SLO burn rate), log-based alerts, incidents, alert documentation.
Data typeIncidents (open, resolved).
Inputs (internal components)Cloud Monitoring, Managed Prometheus, Cloud Logging.
Outputs (internal components)Incidents in the console.
External interactionsEmail, SMS, mobile app, Slack, PagerDuty, webhooks, Pub/Sub.
Can be opened to the outside🟠 Yes: outgoing notifications and webhooks.
Security and accessMonitoring Editor IAM; webhook tokens.
CostPer alert condition and per evaluated series.

Query APIs (Monitoring, Prometheus, Logging, Trace) #

The APIs that expose all Google Cloud observability data for reading.

CharacteristicDetail
RoleLet tools and scripts query metrics, logs and traces.
ContentCloud Monitoring API (timeSeries), Prometheus HTTP API (PromQL), Cloud Logging API (entries.list), Cloud Trace API; client libraries.
Data typeJSON or protobuf responses.
Inputs (internal components)Cloud Monitoring, Managed Prometheus, Cloud Logging, Cloud Trace.
Outputs (internal components)Any authorized client.
External interactionsGrafana, Datadog, Dynatrace, New Relic, scripts.
Can be opened to the outside🟠 Yes: googleapis.com endpoints (or Private Service Connect).
Security and accessService account with read roles (Monitoring Viewer, Logs Viewer); VPC Service Controls available.
CostMonitoring API reads billed beyond the quota.

Log sinks (Pub/Sub, BigQuery, Cloud Storage) #

The log router outputs, at project, folder or organization level.

CharacteristicDetail
RoleContinuously export filtered logs to an analysis, archiving or streaming destination.
ContentInclusion filter, exclusions, destination, writer identity (service account); aggregated sinks for a whole organization.
Data typeLog entries in JSON format.
Storage and retentionDepends on the destination: BigQuery (partitioned tables), Cloud Storage (hourly files), Pub/Sub (7 days message retention by default).
Inputs (internal components)Cloud Logging (router).
Outputs (internal components)Buckets in other projects, BigQuery, Cloud Storage, Pub/Sub.
External interactionsSplunk (Pub/Sub to Splunk Dataflow template), Datadog, Elastic, Sumo Logic, SIEM through Pub/Sub; BI tools through BigQuery.
Can be opened to the outside🟠 Yes: it is the main continuous export channel.
Security and accessThe sink writer identity must be allowed to publish or write to the destination.
CostRouting is free; destination costs (Pub/Sub, BigQuery, storage).

4. OpenTelemetry compatibility #

Google collector, Telemetry API and exporters.

Sending OpenTelemetry telemetry to Google Cloud #

Google publishes a Google-Built OpenTelemetry Collector and the googlecloud (traces, metrics, logs) and googlemanagedprometheus exporters from the contrib distribution. The Telemetry API (telemetry.googleapis.com) accepts OTLP directly for traces: a standard collector can use it with Google authentication.

receivers:
  otlp: { protocols: { grpc: {}, http: {} } }
processors:
  batch: {}
  resourcedetection: { detectors: [gcp] }
exporters:
  googlecloud: {}                 # traces et journaux vers Cloud Trace et Cloud Logging
  googlemanagedprometheus: {}     # métriques vers Managed Service for Prometheus
service:
  pipelines:
    traces:  { receivers: [otlp], processors: [resourcedetection, batch], exporters: [googlecloud] }
    metrics: { receivers: [otlp], processors: [resourcedetection, batch], exporters: [googlemanagedprometheus] }
    logs:    { receivers: [otlp], processors: [resourcedetection, batch], exporters: [googlecloud] }
Good practice: Prefer googlemanagedprometheus over googlecloud for metrics: they can be queried in PromQL and are billed by number of samples.

5. Interconnections with external products #

Sharing data.

Exporting and integrating #

MechanismDataDestinations
Log sink to Pub/SubFiltered logsSplunk (Pub/Sub to Splunk Dataflow template), Datadog, Elastic, Sumo Logic
Sink to BigQuery or Cloud StorageLogs for analysis or archivingBI tools, data lake, SIEM
Service account integrationsCloud Monitoring metricsDatadog, Dynatrace, New Relic, Elastic
Grafana data sourceCloud Monitoring, Managed Prometheus (PromQL), Logging, TraceGrafana Cloud or self-hosted
Google Security OperationsSecurity logsGoogle's SIEM (Chronicle)
Good to know: Managed Prometheus exposes a Prometheus-compatible API: Grafana or any PromQL-compatible tool can query it directly.

6. Costs and best practices #

Controlling ingestion.

Best practices #

  • Use exclusion filters and suitable retention per log bucket.
  • Centralize an organization's logs with aggregated sinks at folder or organization level.
  • Define SLOs in Cloud Monitoring and alert on error budget burn rate.
  • Enable Cloud Profiler in production: its overhead is low and it reveals performance regressions.
  • Instrument with OpenTelemetry and the Google collector to keep portability.
  • Watch the cardinality of custom and Prometheus metrics.
Watch out: Data Access audit logs are disabled by default and can be very large: enable them only for the services that need them.

Related articles

Understanding Google Cloud: regions, projects, hierarchy, tools and pricing

Google Cloud basics: regions and zones, the organization, folders and projects hierarchy, APIs to enable, con…

IAM on Google Cloud: roles, service accounts and organization policies

Manage access on Google Cloud: principals, basic, predefined and custom roles, IAM bindings, service accounts…

Google Cloud networking: global VPC, subnets, firewall and load balancing

Design networking on Google Cloud: global VPC and regional subnets, firewall rules based on tags and service …

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!