1---2name: gcloud3description: Monitor Google Cloud Run services and Cloud Functions health, metrics, and logs. Use this skill when the user asks about service health, request counts, latencies, or cloud infrastructure.4---56# Google Cloud Integration78## Connection910- **Project**: `BIGQUERY_PROJECT_ID` from Settings → Data sources11- **Service account**: from `GOOGLE_APPLICATION_CREDENTIALS_JSON`12- **Auth**: `GOOGLE_APPLICATION_CREDENTIALS_JSON` credential (JSON credentials string) — no ADC fallback13- **IAM roles**: `monitoring.viewer`, `run.viewer`, `cloudfunctions.viewer`, `logging.viewer`14- **Caching**: 5-minute in-memory cache, max 120 entries1516## Server Lib & API Routes1718- **File**: `server/lib/gcloud.ts`1920### Exported Functions2122| Function | Description |23| --------------------------------------------------------------------------- | ---------------------------------- |24| `listCloudRunServices()` | List all Cloud Run services |25| `listCloudFunctions()` | List all Cloud Functions |26| `queryMetrics(filter, period, aligner?, reducer?, groupBy?)` | Query Cloud Monitoring time series |27| `getServiceMetrics(serviceType, serviceName, metric, period, extraFilter?)` | Convenience metric query |28| `listLogEntries(filter, pageSize?)` | Read Cloud Logging entries |2930### API Routes3132| Route | Description |33| -------------------------- | ----------------------- |34| `GET /api/gcloud/services` | List Cloud Run services |35| `GET /api/gcloud/metrics` | Query metrics |36| `GET /api/gcloud/logs` | Read log entries |3738### Agent Action3940Use `gcloud` for agent-facing Google Cloud work. Do not call41`/api/gcloud/*` directly from the agent.4243| Mode | Args | Description |44| ---------- | ----------------------------------------------------------- | ------------------------------------------- |45| `services` | | List Cloud Run services and Cloud Functions |46| `metrics` | `service`, `serviceType`, `metric`, `period`, `extraFilter` | Query Cloud Monitoring |47| `logs` | `service`, `serviceType`, `severity`, `limit` | Read Cloud Logging |4849### Dashboard5051- `/adhoc/gcloud` — Google Cloud Health dashboard5253## Google Cloud APIs Used5455- Cloud Run Admin API v2: `/v2/projects/{project}/locations/-/services`56- Cloud Functions API v2: `/v2/projects/{project}/locations/-/functions`57- Cloud Monitoring API v3: `/v3/projects/{project}/timeSeries`58- Cloud Logging API v2: `/v2/entries:list`5960## Key Metrics6162- **Cloud Run**: `run.googleapis.com/request_count`, `request_latencies`, `container/instance_count`, `container/cpu/utilization`63- **Cloud Functions**: `cloudfunctions.googleapis.com/function/execution_count`, `execution_times`, `active_instances`6465## Key Patterns & Gotchas6667- **Scale**: 78 Cloud Run services, 237+ Cloud Functions — UI uses searchable dropdown68- **Alignment periods**: 1h→60s, 6h→300s, 24h→600s, 7d→3600s69- `getServiceMetrics` auto-selects aligner/reducer based on metric name (latency→percentile, request_count→ALIGN_DELTA, memory→ALIGN_MEAN)70- `queryMetrics` maps point values from `doubleValue`, `int64Value`, or distribution mean71- `listLogEntries` uses POST payload; returns entries reversed72- Project ID comes from the user's configured `BIGQUERY_PROJECT_ID`.