Skip to content

feat: Add crossplane_managed_resource_* state metrics #307

@lkiii

Description

@lkiii

Summary

Add Prometheus state metrics for all managed resource types, following the Crossplane observability guide.

Motivation

Currently, provider-sql does not expose state metrics for managed resources. These metrics are valuable for:

  • Monitoring the health and status of managed resources at scale
  • Alerting on resources that are not ready or synced
  • Dashboarding resource counts by type and state

Proposed Solution

Implement the following metrics using crossplane-runtime/v2/pkg/statemetrics:

  • crossplane_managed_resource_exists - Count of existing managed resources
  • crossplane_managed_resource_ready - Count of ready managed resources
  • crossplane_managed_resource_synced - Count of synced managed resources

Each metric will be labeled with the GVK (GroupVersionKind) of the resource type.

Implementation Notes

  • Register MRStateRecorder for all 22 managed resource types (PostgreSQL, MySQL, MSSQL - both cluster and namespaced)
  • Poll interval: 30 seconds
  • Add unit tests for the configuration

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions