Skip to content

Commit 6743913

Browse files
committed
first set of metrics
1 parent ea5331d commit 6743913

6 files changed

+72
-6
lines changed

apis/v1beta1/vspherecluster_types.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ type VSphereClusterStatus struct {
8989

9090
// Conditions defines current service state of the VSphereCluster.
9191
// +optional
92+
// +Metrics:stateset:name="status_condition",help="The condition of a vspherecluster.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
93+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a vspherecluster.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
9294
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
9395

9496
// FailureDomains is a list of failure domain objects synced from the infrastructure provider.
@@ -108,8 +110,17 @@ type VSphereClusterStatus struct {
108110
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of Machine"
109111

110112
// VSphereCluster is the Schema for the vsphereclusters API
113+
// +Metrics:gvk:namePrefix="capv_vspherecluster"
114+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
115+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
116+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
117+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
118+
// +Metrics:info:name="info",help="Information about a vspherecluster.",labelsFromPath={status_vsphere_version:.status.vCenterVersion,spec_server:.spec.server}
111119
type VSphereCluster struct {
112-
metav1.TypeMeta `json:",inline"`
120+
metav1.TypeMeta `json:",inline"`
121+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
122+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the vspherecluster is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
123+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
113124
metav1.ObjectMeta `json:"metadata,omitempty"`
114125

115126
Spec VSphereClusterSpec `json:"spec,omitempty"`

apis/v1beta1/vsphereclusteridentity_types.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ type VSphereClusterIdentityStatus struct {
4444

4545
// Conditions defines current service state of the VSphereCluster.
4646
// +optional
47+
// +Metrics:stateset:name="status_condition",help="The condition of a vsphereclusteridentity.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
48+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a vsphereclusteridentity.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
4749
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
4850
}
4951

@@ -84,8 +86,17 @@ func (c *VSphereClusterIdentity) SetConditions(conditions clusterv1.Conditions)
8486
// +kubebuilder:subresource:status
8587

8688
// VSphereClusterIdentity defines the account to be used for reconciling clusters
89+
// +Metrics:gvk:namePrefix="capv_vsphereclusteridentity"
90+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
91+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
92+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
93+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
94+
// +Metrics:info:name="info",help="Information about a vsphereclusteridentity.",labelsFromPath={name:.metadata.name}
8795
type VSphereClusterIdentity struct {
88-
metav1.TypeMeta `json:",inline"`
96+
metav1.TypeMeta `json:",inline"`
97+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
98+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the vsphereclusteridentity is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
99+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
89100
metav1.ObjectMeta `json:"metadata,omitempty"`
90101

91102
Spec VSphereClusterIdentitySpec `json:"spec,omitempty"`

apis/v1beta1/vspheredeploymentzone_types.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ type VSphereDeploymentZoneStatus struct {
8181

8282
// Conditions defines current service state of the VSphereMachine.
8383
// +optional
84+
// +Metrics:stateset:name="status_condition",help="The condition of a vspheredeploymentzone.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
85+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a vspheredeploymentzone.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
8486
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
8587
}
8688

@@ -90,8 +92,17 @@ type VSphereDeploymentZoneStatus struct {
9092
// +kubebuilder:subresource:status
9193

9294
// VSphereDeploymentZone is the Schema for the vspheredeploymentzones API
95+
// +Metrics:gvk:namePrefix="capv_vspheredeploymentzone"
96+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
97+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
98+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
99+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
100+
// +Metrics:info:name="info",help="Information about a vspheredeploymentzone.",labelsFromPath={name:.metadata.name}
93101
type VSphereDeploymentZone struct {
94-
metav1.TypeMeta `json:",inline"`
102+
metav1.TypeMeta `json:",inline"`
103+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
104+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the vspheredeploymentzone is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
105+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
95106
metav1.ObjectMeta `json:"metadata,omitempty"`
96107

97108
Spec VSphereDeploymentZoneSpec `json:"spec,omitempty"`

apis/v1beta1/vspherefailuredomain_types.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,17 @@ type FailureDomainHosts struct {
9595
// +kubebuilder:resource:path=vspherefailuredomains,scope=Cluster,categories=cluster-api
9696

9797
// VSphereFailureDomain is the Schema for the vspherefailuredomains API
98+
// +Metrics:gvk:namePrefix="capv_vspherefailuredomain"
99+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
100+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
101+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
102+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
103+
// +Metrics:info:name="info",help="Information about a vspherefailuredomain.",labelsFromPath={name:.metadata.name}
98104
type VSphereFailureDomain struct {
99-
metav1.TypeMeta `json:",inline"`
105+
metav1.TypeMeta `json:",inline"`
106+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
107+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the vspherefailuredomain is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
108+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
100109
metav1.ObjectMeta `json:"metadata,omitempty"`
101110

102111
Spec VSphereFailureDomainSpec `json:"spec,omitempty"`

apis/v1beta1/vspheremachine_types.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ type VSphereMachineStatus struct {
7878
Ready bool `json:"ready"`
7979

8080
// Addresses contains the VSphere instance associated addresses.
81+
// +Metrics:info:name="addresses",help="Address information about a vspheremachine.",labelsFromPath={address:".address",type:".type"}
8182
Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"`
8283

8384
// Network returns the network status for each of the machine's configured
@@ -125,6 +126,8 @@ type VSphereMachineStatus struct {
125126

126127
// Conditions defines current service state of the VSphereMachine.
127128
// +optional
129+
// +Metrics:stateset:name="status_condition",help="The condition of a vspheremachine.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
130+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a vspheremachine.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
128131
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
129132
}
130133

@@ -139,8 +142,17 @@ type VSphereMachineStatus struct {
139142
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of Machine"
140143

141144
// VSphereMachine is the Schema for the vspheremachines API
145+
// +Metrics:gvk:namePrefix="capv_vspheremachine"
146+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
147+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
148+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
149+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
150+
// +Metrics:info:name="info",help="Information about a vspheremachine.",labelsFromPath={provider_id:.spec.providerID}
142151
type VSphereMachine struct {
143-
metav1.TypeMeta `json:",inline"`
152+
metav1.TypeMeta `json:",inline"`
153+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
154+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the vspheremachine is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
155+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
144156
metav1.ObjectMeta `json:"metadata,omitempty"`
145157

146158
Spec VSphereMachineSpec `json:"spec,omitempty"`

apis/v1beta1/vspherevm_types.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ type VSphereVMStatus struct {
104104
// This field is required at runtime for other controllers that read
105105
// this CRD as unstructured data.
106106
// +optional
107+
// +Metrics:info:name="addresses",help="Address information about a vspherevm.",labelsFromPath={address:"."}
107108
Addresses []string `json:"addresses,omitempty"`
108109

109110
// CloneMode is the type of clone operation used to clone this VM. Since
@@ -165,6 +166,8 @@ type VSphereVMStatus struct {
165166

166167
// Conditions defines current service state of the VSphereVM.
167168
// +optional
169+
// +Metrics:stateset:name="status_condition",help="The condition of a vspherevm.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
170+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a vspherevm.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
168171
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
169172

170173
// ModuleUUID is the unique identifier for the vCenter cluster module construct
@@ -187,8 +190,17 @@ type VSphereVMStatus struct {
187190
// +kubebuilder:subresource:status
188191

189192
// VSphereVM is the Schema for the vspherevms API
193+
// +Metrics:gvk:namePrefix="capv_vspherevm"
194+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
195+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
196+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
197+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
198+
// +Metrics:info:name="info",help="Information about a vspherevm.",labelsFromPath={status_clonemode:.status.cloneMode}
190199
type VSphereVM struct {
191-
metav1.TypeMeta `json:",inline"`
200+
metav1.TypeMeta `json:",inline"`
201+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
202+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the vspherevm is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
203+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
192204
metav1.ObjectMeta `json:"metadata,omitempty"`
193205

194206
Spec VSphereVMSpec `json:"spec,omitempty"`

0 commit comments

Comments
 (0)