crossplane-contrib / provider-kubernetes

Crossplane provider to provision and manage Kubernetes objects on (remote) Kubernetes clusters.
Apache License 2.0
136 stars 80 forks source link

Introduce MR metrics #224

Closed ezgidemirel closed 1 month ago

ezgidemirel commented 2 months ago

Description of your changes

This change consumes MR metric changes from crossplane-runtime and configures metrics.

I have:

How has this code been tested

Deployed the custom version to a cluster and get metrics

Ezgis-MacBook-Pro:phase-2 ezgidemirel$ 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="kubernetes.crossplane.io/v1alpha2, Kind=Object"} 60
# 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="kubernetes.crossplane.io/v1alpha2, Kind=Object"} 59
# 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="kubernetes.crossplane.io/v1alpha2, Kind=Object"} 59
lsviben commented 1 month ago

Thanks @ezgidemirel ! LGTM, just have one question. Do we want to add a flag to enable/disable the metrics? How was this handled for other providers?

ezgidemirel commented 1 month ago

Thanks @ezgidemirel ! LGTM, just have one question. Do we want to add a flag to enable/disable the metrics? How was this handled for other providers?

Thanks @lsviben for your review! Here is an example PR from provider-upjet-aws. We don't have any flags for the feature.