Skip to content

Commit 78015b5

Browse files
committed
Adjusted wording
1 parent 108c1d8 commit 78015b5

4 files changed

Lines changed: 54 additions & 46 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ node_modules
55

66
# draw.io temp files
77
.$*.bkp
8-
.$*.dtmp
8+
.$*.dtmp
9+
venv

metrics-collector/main.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func formatPrometheusMetrics(metrics []InstanceResourceStats, namespace string,
9393
sb.WriteString("# HELP ibm_codeengine_instance_cpu_usage_millicores Current CPU usage in millicores\n")
9494
sb.WriteString("# TYPE ibm_codeengine_instance_cpu_usage_millicores gauge\n")
9595
for _, m := range metrics {
96-
labels := fmt.Sprintf("instance_name=\"%s\",component_type=\"%s\",component_name=\"%s\"",
96+
labels := fmt.Sprintf("ibm_codeengine_instance_name=\"%s\",ibm_codeengine_component_type=\"%s\",ibm_codeengine_component_name=\"%s\"",
9797
escapeLabelValue(m.Name),
9898
escapeLabelValue(m.ComponentType),
9999
escapeLabelValue(m.ComponentName))
@@ -106,7 +106,7 @@ func formatPrometheusMetrics(metrics []InstanceResourceStats, namespace string,
106106
sb.WriteString("# TYPE ibm_codeengine_instance_cpu_limit_millicores gauge\n")
107107
for _, m := range metrics {
108108
if m.Cpu.Configured > 0 {
109-
labels := fmt.Sprintf("instance_name=\"%s\",component_type=\"%s\",component_name=\"%s\"",
109+
labels := fmt.Sprintf("ibm_codeengine_instance_name=\"%s\",ibm_codeengine_component_type=\"%s\",ibm_codeengine_component_name=\"%s\"",
110110
escapeLabelValue(m.Name),
111111
escapeLabelValue(m.ComponentType),
112112
escapeLabelValue(m.ComponentName))
@@ -119,7 +119,7 @@ func formatPrometheusMetrics(metrics []InstanceResourceStats, namespace string,
119119
sb.WriteString("# HELP ibm_codeengine_instance_memory_usage_bytes Current memory usage in bytes\n")
120120
sb.WriteString("# TYPE ibm_codeengine_instance_memory_usage_bytes gauge\n")
121121
for _, m := range metrics {
122-
labels := fmt.Sprintf("instance_name=\"%s\",component_type=\"%s\",component_name=\"%s\"",
122+
labels := fmt.Sprintf("ibm_codeengine_instance_name=\"%s\",ibm_codeengine_component_type=\"%s\",ibm_codeengine_component_name=\"%s\"",
123123
escapeLabelValue(m.Name),
124124
escapeLabelValue(m.ComponentType),
125125
escapeLabelValue(m.ComponentName))
@@ -133,7 +133,7 @@ func formatPrometheusMetrics(metrics []InstanceResourceStats, namespace string,
133133
sb.WriteString("# TYPE ibm_codeengine_instance_memory_limit_bytes gauge\n")
134134
for _, m := range metrics {
135135
if m.Memory.Configured > 0 {
136-
labels := fmt.Sprintf("instance_name=\"%s\",component_type=\"%s\",component_name=\"%s\"",
136+
labels := fmt.Sprintf("ibm_codeengine_instance_name=\"%s\",ibm_codeengine_component_type=\"%s\",ibm_codeengine_component_name=\"%s\"",
137137
escapeLabelValue(m.Name),
138138
escapeLabelValue(m.ComponentType),
139139
escapeLabelValue(m.ComponentName))
@@ -157,7 +157,7 @@ func formatPrometheusMetrics(metrics []InstanceResourceStats, namespace string,
157157
sb.WriteString("# TYPE ibm_codeengine_instance_ephemeral_storage_usage_bytes gauge\n")
158158
for _, m := range metrics {
159159
if m.DiskUsage.Current > 0 {
160-
labels := fmt.Sprintf("instance_name=\"%s\",component_type=\"%s\",component_name=\"%s\"",
160+
labels := fmt.Sprintf("ibm_codeengine_instance_name=\"%s\",ibm_codeengine_component_type=\"%s\",ibm_codeengine_component_name=\"%s\"",
161161
escapeLabelValue(m.Name),
162162
escapeLabelValue(m.ComponentType),
163163
escapeLabelValue(m.ComponentName))
@@ -687,10 +687,17 @@ func getUserContainerName(componentType ComponentType, pod *v1.Pod) string {
687687
return "user-container"
688688
}
689689

690-
if componentType == Job || componentType == Build {
690+
if componentType == Job {
691691
return pod.Spec.Containers[0].Name
692692
}
693693

694+
// builds are using two containers:
695+
// a quite small 'step-source-default'
696+
// and the 'step-build-and-push' which does the heavy lifting
697+
if componentType == Build && len(pod.Spec.Containers) > 1 {
698+
return pod.Spec.Containers[1].Name
699+
}
700+
694701
// for kube-native deployments, we pick the first container
695702
return pod.Spec.Containers[0].Name
696703
}

metrics-collector/prometheus.yml.template

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
global:
22
scrape_interval: 30s
33
external_labels:
4-
code_engine_project_name: '${CE_PROJECT_NAME}'
4+
ibm_codeengine_project_name: '${CE_PROJECT_NAME}'
55

66
scrape_configs:
77
- job_name: 'codeengine-metrics-project'
@@ -13,7 +13,7 @@ scrape_configs:
1313
action: replace
1414
regex: (.+)
1515
replacement: '${CE_PROJECT_NAME}'
16-
target_label: code_engine_project_name
16+
target_label: ibm_codeengine_project_name
1717
metric_relabel_configs:
1818
# Droping scrape metrics (e.g. scrape_duration_seconds)
1919
- source_labels: [__name__]
@@ -50,31 +50,31 @@ scrape_configs:
5050
# rename important meta data labels
5151
- source_labels: [__meta_kubernetes_namespace]
5252
action: replace
53-
target_label: code_engine_project_namespace
53+
target_label: ibm_codeengine_namespace
5454
- source_labels: [job]
5555
action: replace
5656
regex: (.+)
5757
replacement: '${CE_PROJECT_NAME}'
58-
target_label: code_engine_project_name
58+
target_label: ibm_codeengine_project_name
5959
- source_labels: [__meta_kubernetes_pod_name]
6060
action: replace
61-
target_label: code_engine_instance_name
61+
target_label: ibm_codeengine_instance_name
6262
- source_labels: [__meta_kubernetes_pod_label_serving_knative_dev_service]
6363
action: replace
64-
target_label: code_engine_component_name
64+
target_label: ibm_codeengine_component_name
6565
- source_labels: [__meta_kubernetes_pod_label_serving_knative_dev_configuration]
6666
action: replace
6767
regex: (.+)
6868
replacement: app
69-
target_label: code_engine_component_type
69+
target_label: ibm_codeengine_component_type
7070
- source_labels: [__meta_kubernetes_pod_label_serving_knative_dev_revision]
7171
action: replace
72-
target_label: code_engine_subcomponent_name
72+
target_label: ibm_codeengine_subcomponent_name
7373
- source_labels: [__meta_kubernetes_pod_label_serving_knative_dev_revisionUID]
7474
action: replace
7575
regex: (.+)
7676
replacement: app_revision
77-
target_label: code_engine_subcomponent_type
77+
target_label: ibm_codeengine_subcomponent_type
7878
# drop codeengine, istio, and knative labels
7979
- action: labeldrop
8080
regex: "codeengine_cloud_ibm_com_(.+)"

metrics-collector/setup/ibm-cloud-monitoring/code-engine-component-resource-overview.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"description": "",
99
"nullValueDisplayText": null,
1010
"links": null,
11-
"markdownSource": "Monitor CPU, and Memory usage across Code Engine components.\n\n**Use the scope filters above to narrow by:**\n- `component_type` (app, job, build)\n- `component_name` (specific app/job/build name)",
11+
"markdownSource": "Monitor CPU, and Memory usage across Code Engine components.\n\n**Use the scope filters above to narrow by:**\n- `ibm_codeengine_component_type` (app, job, build)\n- `ibm_codeengine_component_name` (specific app/job/build name)",
1212
"transparentBackground": false,
1313
"panelTitleVisible": true,
1414
"textAutosized": false
@@ -17,16 +17,16 @@
1717
"id": 5,
1818
"type": "advancedTimechart",
1919
"name": "CPU Utilization % (by Component)",
20-
"description": "CPU usage as percentage of limit, grouped by component_name",
20+
"description": "CPU usage as percentage of limit, grouped by ibm_codeengine_component_name",
2121
"nullValueDisplayText": null,
2222
"links": null,
2323
"advancedQueries": [
2424
{
25-
"query": "(sum by (component_name) (ibm_codeengine_instance_cpu_usage_millicores{$__scope}) / sum by (component_name) (ibm_codeengine_instance_cpu_limit_millicores)) * 100",
25+
"query": "(sum by (ibm_codeengine_component_name) (ibm_codeengine_instance_cpu_usage_millicores{$__scope}) / sum by (ibm_codeengine_component_name) (ibm_codeengine_instance_cpu_limit_millicores)) * 100",
2626
"enabled": true,
2727
"displayInfo": {
2828
"displayName": "CPU %",
29-
"timeSeriesDisplayNameTemplate": "{{component_name}}",
29+
"timeSeriesDisplayNameTemplate": "{{ibm_codeengine_component_name}}",
3030
"type": "lines"
3131
},
3232
"format": {
@@ -110,16 +110,16 @@
110110
"id": 6,
111111
"type": "advancedTimechart",
112112
"name": "Memory Utilization % (by Component)",
113-
"description": "Memory usage as percentage of limit, grouped by component_name",
113+
"description": "Memory usage as percentage of limit, grouped by ibm_codeengine_component_name",
114114
"nullValueDisplayText": null,
115115
"links": null,
116116
"advancedQueries": [
117117
{
118-
"query": "(sum by (component_name) (ibm_codeengine_instance_memory_usage_bytes{$__scope}) / sum by (component_name) (ibm_codeengine_instance_memory_limit_bytes{$__scope})) * 100",
118+
"query": "(sum by (ibm_codeengine_component_name) (ibm_codeengine_instance_memory_usage_bytes{$__scope}) / sum by (ibm_codeengine_component_name) (ibm_codeengine_instance_memory_limit_bytes{$__scope})) * 100",
119119
"enabled": true,
120120
"displayInfo": {
121121
"displayName": "Memory %",
122-
"timeSeriesDisplayNameTemplate": "{{component_name}}",
122+
"timeSeriesDisplayNameTemplate": "{{ibm_codeengine_component_name}}",
123123
"type": "lines"
124124
},
125125
"format": {
@@ -510,7 +510,7 @@
510510
"enabled": true,
511511
"displayInfo": {
512512
"displayName": "CPU Usage",
513-
"timeSeriesDisplayNameTemplate": "{{component_name}}/{{instance_name}} usage",
513+
"timeSeriesDisplayNameTemplate": "{{ibm_codeengine_component_name}}/{{ibm_codeengine_instance_name}} usage",
514514
"type": "lines"
515515
},
516516
"format": {
@@ -590,7 +590,7 @@
590590
"enabled": true,
591591
"displayInfo": {
592592
"displayName": "Memory Usage",
593-
"timeSeriesDisplayNameTemplate": "{{component_name}}/{{instance_name}} usage",
593+
"timeSeriesDisplayNameTemplate": "{{ibm_codeengine_component_name}}/{{ibm_codeengine_instance_name}} usage",
594594
"type": "lines"
595595
},
596596
"format": {
@@ -666,7 +666,7 @@
666666
"links": null,
667667
"advancedQueries": [
668668
{
669-
"query": "count(count(\n ibm_codeengine_instance_cpu_limit_millicores{$__scope}\n)by (component_name))",
669+
"query": "count(count(\n ibm_codeengine_instance_cpu_limit_millicores{$__scope}\n)by (ibm_codeengine_component_name))",
670670
"enabled": true,
671671
"displayInfo": {
672672
"displayName": "CPU %",
@@ -707,7 +707,7 @@
707707
"links": null,
708708
"advancedQueries": [
709709
{
710-
"query": "count by (code_engine_instance_name) (ibm_codeengine_instance_cpu_limit_millicores{$__scope})",
710+
"query": "count by (ibm_codeengine_instance_name) (ibm_codeengine_instance_cpu_limit_millicores{$__scope})",
711711
"enabled": true,
712712
"displayInfo": {
713713
"displayName": "CPU %",
@@ -749,18 +749,18 @@
749749
],
750750
"scopeExpressionList": [
751751
{
752-
"operand": "code_engine_project_name",
752+
"operand": "ibm_codeengine_project_name",
753753
"operator": "in",
754754
"displayName": "",
755755
"value": [],
756756
"descriptor": {
757-
"documentId": "code_engine_project_name",
758-
"id": "code_engine_project_name",
757+
"documentId": "ibm_codeengine_project_name",
758+
"id": "ibm_codeengine_project_name",
759759
"metricType": "tag",
760760
"type": "string",
761761
"scale": 0.0,
762-
"name": "code_engine_project_name",
763-
"description": "code_engine_project_name",
762+
"name": "ibm_codeengine_project_name",
763+
"description": "ibm_codeengine_project_name",
764764
"namespaces": [
765765
"cloudProvider",
766766
"host.container",
@@ -809,7 +809,7 @@
809809
"canGroupBy": false,
810810
"canFilter": true,
811811
"generatedFrom": "com.draios.model.metrics.custom.CustomMetric$Tag",
812-
"publicId": "code_engine_project_name",
812+
"publicId": "ibm_codeengine_project_name",
813813
"heuristic": false,
814814
"documentType": "metric",
815815
"segment": false,
@@ -819,18 +819,18 @@
819819
"isVariable": true
820820
},
821821
{
822-
"operand": "component_type",
822+
"operand": "ibm_codeengine_component_type",
823823
"operator": "in",
824824
"displayName": "",
825825
"value": [],
826826
"descriptor": {
827-
"documentId": "component_type",
828-
"id": "component_type",
827+
"documentId": "ibm_codeengine_component_type",
828+
"id": "ibm_codeengine_component_type",
829829
"metricType": "tag",
830830
"type": "string",
831831
"scale": 0.0,
832-
"name": "component_type",
833-
"description": "component_type",
832+
"name": "ibm_codeengine_component_type",
833+
"description": "ibm_codeengine_component_type",
834834
"namespaces": [
835835
"cloudProvider",
836836
"host.container",
@@ -879,7 +879,7 @@
879879
"canGroupBy": false,
880880
"canFilter": true,
881881
"generatedFrom": "com.draios.model.metrics.custom.CustomMetric$Tag",
882-
"publicId": "component_type",
882+
"publicId": "ibm_codeengine_component_type",
883883
"heuristic": false,
884884
"documentType": "metric",
885885
"segment": false,
@@ -889,18 +889,18 @@
889889
"isVariable": true
890890
},
891891
{
892-
"operand": "component_name",
892+
"operand": "ibm_codeengine_component_name",
893893
"operator": "in",
894894
"displayName": "",
895895
"value": [],
896896
"descriptor": {
897-
"documentId": "component_name",
898-
"id": "component_name",
897+
"documentId": "ibm_codeengine_component_name",
898+
"id": "ibm_codeengine_component_name",
899899
"metricType": "tag",
900900
"type": "string",
901901
"scale": 0.0,
902-
"name": "component_name",
903-
"description": "component_name",
902+
"name": "ibm_codeengine_component_name",
903+
"description": "ibm_codeengine_component_name",
904904
"namespaces": [
905905
"cloudProvider",
906906
"host.container",
@@ -949,7 +949,7 @@
949949
"canGroupBy": false,
950950
"canFilter": true,
951951
"generatedFrom": "com.draios.model.metrics.custom.CustomMetric$Tag",
952-
"publicId": "component_name",
952+
"publicId": "ibm_codeengine_component_name",
953953
"heuristic": false,
954954
"documentType": "metric",
955955
"segment": false,
@@ -971,7 +971,7 @@
971971
},
972972
"shared": true,
973973
"public": false,
974-
"description": "Overview of Code Engine instance resource usage: CPU/memory current vs limits, with filtering by component_type and component_name",
974+
"description": "Overview of Code Engine instance resource usage: CPU/memory current vs limits, with filtering by ibm_codeengine_component_type and ibm_codeengine_component_name",
975975
"layout": [
976976
{
977977
"panelId": 1,

0 commit comments

Comments
 (0)