upbound / provider-terraform

A @crossplane provider for Terraform
Apache License 2.0
124 stars 55 forks source link

feat: introduce MR metrics #277

Closed arththebird closed 2 days ago

arththebird commented 6 days ago

Description of your changes

Consume https://github.com/crossplane/crossplane-runtime/pull/683 and configure metrics for Workspaces.

Heavily inspired by https://github.com/crossplane-contrib/provider-kubernetes/pull/224 and https://github.com/crossplane-contrib/provider-upjet-aws/pull/1281

Fixes #271

I have:

How has this code been tested

  1. Deploy the provider locally using make local-deploy
  2. Get the metrics from the provider pod (curl -s http://localhost:8080/metrics | grep crossplane)
# HELP crossplane_managed_resource_exists The number of managed resources that exist
# TYPE crossplane_managed_resource_exists gauge
crossplane_managed_resource_exists{gvk="tf.upbound.io/v1beta1, Kind=Workspace"} 1
# HELP crossplane_managed_resource_ready The number of managed resources in Ready=True state
# TYPE crossplane_managed_resource_ready gauge
crossplane_managed_resource_ready{gvk="tf.upbound.io/v1beta1, Kind=Workspace"} 1
# HELP crossplane_managed_resource_synced The number of managed resources in Synced=True state
# TYPE crossplane_managed_resource_synced gauge
crossplane_managed_resource_synced{gvk="tf.upbound.io/v1beta1, Kind=Workspace"} 1