Skip to content

Commit a3fb700

Browse files
authored
Merge pull request #27 from datum-cloud/add-resource-metrics
Add resource metrics
2 parents 2aaeea8 + 833334a commit a3fb700

File tree

6 files changed

+137
-0
lines changed

6 files changed

+137
-0
lines changed

config/default/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ resources:
1818
# - ../crd
1919
# - ../rbac
2020
- ../manager
21+
- ../resource-metrics
2122
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2223
# crd/kustomization.yaml
2324
# - ../webhook
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
kind: CustomResourceStateMetrics
2+
spec:
3+
resources:
4+
# Creates a generic metric for all resources
5+
- groupVersionKind:
6+
group: compute.datumapis.com
7+
kind: "*"
8+
version: "*"
9+
metricNamePrefix: "datum_cloud_resource"
10+
labelsFromPath:
11+
namespace: [metadata, namespace]
12+
name: [metadata, name]
13+
metrics:
14+
- name: "info"
15+
help: "Information about the resource"
16+
each:
17+
type: Info
18+
info:
19+
labelsFromPath:
20+
uid: [metadata, uid]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
kind: CustomResourceStateMetrics
2+
spec:
3+
resources:
4+
- groupVersionKind:
5+
group: compute.datumapis.com
6+
kind: Instance
7+
version: v1alpha
8+
metricNamePrefix: "datum_cloud_compute_instance"
9+
labelsFromPath:
10+
namespace: [metadata, namespace]
11+
name: [metadata, name]
12+
metrics:
13+
- name: "info"
14+
help: "Information about instance"
15+
each:
16+
type: Info
17+
info:
18+
labelsFromPath:
19+
uid: [metadata, uid]
20+
compute_datumapis_com_workload_deployment_uid: [metadata, labels, compute_datumapis_com_workload_deployment_uid]
21+
compute_datumapis_com_workload_uid: [metadata, labels, compute_datumapis_com_workload_uid]
22+
- name: "status_condition"
23+
help: "The current status conditions of the instance"
24+
each:
25+
type: Gauge
26+
gauge:
27+
path: [status, conditions]
28+
labelsFromPath:
29+
condition: [type]
30+
reason: [reason]
31+
status: [status]
32+
valueFrom: [status]
33+
- name: "network_interface_info"
34+
help: "Information about instance network interfaces"
35+
each:
36+
type: Info
37+
info:
38+
path: [status, networkInterfaces]
39+
labelsFromPath:
40+
network_ip: [assignments, networkIP]
41+
external_ip: [assignments, externalIP]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
configMapGenerator:
5+
- name: workload-services-metrics
6+
options:
7+
labels:
8+
telemetry.datumapis.com/resource-metrics-config: "true"
9+
10+
files:
11+
- general.yaml
12+
- instances.yaml
13+
- workload-deployments.yaml
14+
- workloads.yaml
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
kind: CustomResourceStateMetrics
2+
spec:
3+
resources:
4+
- groupVersionKind:
5+
group: compute.datumapis.com
6+
kind: WorkloadDeployment
7+
version: v1alpha
8+
metricNamePrefix: "datum_cloud_compute_workload_deployment"
9+
labelsFromPath:
10+
namespace: [metadata, namespace]
11+
name: [metadata, name]
12+
metrics:
13+
- name: "info"
14+
help: "Information about workload deployment"
15+
each:
16+
type: Info
17+
info:
18+
labelsFromPath:
19+
uid: [metadata, uid]
20+
compute_datumapis_com_workload_uid: [metadata, labels, compute_datumapis_com_workload_uid]
21+
- name: "status_condition"
22+
help: "The current status conditions of the workload deployment"
23+
each:
24+
type: Gauge
25+
gauge:
26+
path: [status, conditions]
27+
labelsFromPath:
28+
condition: [type]
29+
reason: [reason]
30+
status: [status]
31+
valueFrom: [status]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
kind: CustomResourceStateMetrics
2+
spec:
3+
resources:
4+
- groupVersionKind:
5+
group: compute.datumapis.com
6+
kind: Workload
7+
version: v1alpha
8+
metricNamePrefix: "datum_cloud_compute_workload"
9+
labelsFromPath:
10+
namespace: [metadata, namespace]
11+
name: [metadata, name]
12+
metrics:
13+
- name: "info"
14+
help: "Information about workload"
15+
each:
16+
type: Info
17+
info:
18+
labelsFromPath:
19+
uid: [metadata, uid]
20+
- name: "status_condition"
21+
help: "The current status conditions of the workload"
22+
each:
23+
type: Gauge
24+
gauge:
25+
path: [status, conditions]
26+
labelsFromPath:
27+
condition: [type]
28+
reason: [reason]
29+
status: [status]
30+
valueFrom: [status]

0 commit comments

Comments
 (0)