-
Notifications
You must be signed in to change notification settings - Fork 2
Description
What happened:
ManagedMetrics are always exported with value 1, resulting in a loss of information in the metrics backend.
When we create 2 ConfigMaps with provider-kubernetes, all of them being ready and synced, then the metric value is properly displayed as 2 inside the cluster since the status.observation value is set to the number of retrieved resources.
NAME READY VALUE OBSERVED
kubernetes-objects-v1alpha2 True 2 5s
The same metric will always be exported with value 1 to the DataSink as long as there are no distinguishing metric attributes that lead to additional datapoints with value 1, e.g. having ConfigMaps in status synced/ready false. These could then again be aggregated in the metrics backend but as soon as you have two or more identical 'buckets', information regarding the real number of resources is lost.
What you expected to happen:
The value of a ManagedMetric has to reflect the number of resources with the same attribute values when exported to the DataSink, e.g. 2 in the previous example.
How to reproduce it (as minimally and precisely as possible):
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-kubernetes
spec:
package: xpkg.upbound.io/upbound/provider-kubernetes:v0.16.0
---
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: kubernetes-provider
namespace: default
spec:
credentials:
source: InjectedIdentity
---
apiVersion: kubernetes.crossplane.io/v1alpha2
kind: Object
metadata:
name: foo-alpha2
namespace: default
spec:
forProvider:
manifest:
apiVersion: v1
kind: ConfigMap
metadata:
namespace: default
providerConfigRef:
name: kubernetes-provider
---
apiVersion: kubernetes.crossplane.io/v1alpha2
kind: Object
metadata:
name: bar-alpha2
namespace: default
spec:
forProvider:
manifest:
apiVersion: v1
kind: ConfigMap
metadata:
namespace: default
providerConfigRef:
name: kubernetes-provider
---
apiVersion: metrics.openmcp.cloud/v1alpha1
kind: ManagedMetric
metadata:
name: kubernetes-objects-v1alpha2
spec:
name: kubernetes-objects-v1alpha2
target:
kind: Object
group: kubernetes.crossplane.io
version: v1alpha2
interval: "15s"
Anything else we need to know:
Environment: