Skip to content

[P1.5-S6-ARI-42] Cloud Monitoring API integration — metrics-based signals #76

Description

@bjridicodes

Ticket: P1.5-S6-04

Type: Feature | Est: 1.5d

Goal: For GCP services with sparse logs (Pub/Sub backlog depth, Cloud Function error rate, BigQuery quota), ARIA surfaces Cloud Monitoring metrics as structured signals alongside log results — preventing LOW confidence classifications when logs are absent but metrics indicate a problem.

Scope:

  • implementations/clusters/cloud/gcp/monitoring_connector.py (new): GCPMonitoringConnector
    • Uses google.cloud.monitoring_v3.MetricServiceClient; auth via ADC
    • query_metrics(project_id: str, resource_type: str, start_time: datetime, end_time: datetime) -> list[MetricSignal]
    • MetricSignal dataclass: { metric_type: str, resource_type: str, value: float, unit: str, timestamp: datetime, labels: dict }
    • Metric targets:
      • Pub/Sub: pubsub.googleapis.com/subscription/num_undelivered_messages
      • Cloud Functions: cloudfunctions.googleapis.com/function/execution_count (filter status != OK)
      • BigQuery: bigquery.googleapis.com/storage/table_count (proxy for quota health)
  • requirements.txt: add google-cloud-monitoring >= 2.20.0
  • core/agents/log_extractor.py: when GCPMonitoringConnector is injected (optional, via DI), call query_metrics() for GCP platform incidents and append metric signals as LogLine objects (level WARNING, message = formatted metric reading) to LogQueryResult
  • api/dependencies.py: inject GCPMonitoringConnector into get_agent2() when ARIA_VAULT_BACKEND=gcp

Acceptance criteria:

  • GCPMonitoringConnector.query_metrics() returns at least 1 MetricSignal for a live Pub/Sub subscription with a backlog
  • Log extractor appends metric signals to log_result.log_lines for GCP platform incidents
  • Unit test with mocked MetricServiceClient; assert correct metric path constructed and signals returned

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1.5-S6S6: GCP Native Service ConnectorsfeatureNew capability or user-facing functionalityphase-1.5All Phase 1.5 issues

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions