Skip to content

Commit

Permalink
Add label_replace to work with new and old label name
Browse files Browse the repository at this point in the history
  • Loading branch information
pipo02mix committed Jul 12, 2024
1 parent 060cc34 commit 451a426
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum (etcd_kubernetes_resources_count{cluster_id=\"$cluster\", exported_namespace=~\"$namespace\"}) by (kind)",
"expr": "sum ( label_replace(etcd_kubernetes_resources_count{namespace=~\"$namespace\", cluster_id=~\"$cluster\"}, \"target_namespace\", \"$1\", \"namespace\", \"(.*)\") or label_replace(etcd_kubernetes_resources_count{exported_namespace=~\"$namespace\", cluster_id=~\"$cluster\"}, \"target_namespace\", \"$1\", \"exported_namespace\", \"(.*)\") ) by (kind) / 2",
"instant": false,
"interval": "",
"legendFormat": "{{kind}}",
Expand Down Expand Up @@ -219,9 +219,9 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum (etcd_kubernetes_resources_count{cluster_id=\"$cluster\", exported_namespace=~\"$namespace\"}) by (exported_namespace)",
"expr": "sum ( label_replace(etcd_kubernetes_resources_count{namespace=~\"$namespace\", cluster_id=~\"$cluster\"}, \"target_namespace\", \"$1\", \"namespace\", \"(.*)\") or label_replace(etcd_kubernetes_resources_count{exported_namespace=~\"$namespace\", cluster_id=~\"$cluster\"}, \"target_namespace\", \"$1\", \"exported_namespace\", \"(.*)\") ) by (target_namespace) / 2",
"interval": "",
"legendFormat": "{{exported_namespace}}",
"legendFormat": "{{target_namespace}}",
"range": true,
"refId": "A"
}
Expand Down Expand Up @@ -313,7 +313,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(etcd_kubernetes_resources_count{cluster_id=\"$cluster\", kind=\"events\",exported_namespace=~\"$namespace\"})",
"expr": "sum(label_replace(etcd_kubernetes_events_count{kind=\"events\",cluster_id=\"$cluster\",exported_namespace=~\"$namespace\"}, \"target_namespace\", \"$1\", \"exported_namespace\", \"(.*)\") or label_replace(etcd_kubernetes_events_count{kind=\"events\",cluster_id=\"$cluster\",namespace=~\"$namespace\"}, \"target_namespace\", \"$1\", \"namespace\", \"(.*)\")) / 2",
"instant": true,
"interval": "",
"legendFormat": "",
Expand Down Expand Up @@ -406,10 +406,10 @@
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(rate(etcd_kubernetes_events_count{cluster_id=\"$cluster\", exported_namespace=~\"$namespace\"}[1h])) by (exported_namespace)",
"expr": "sum(label_replace(rate(etcd_kubernetes_events_count{cluster_id=\"$cluster\", namespace=~\"$namespace\"}[1h]), \"target_namespace\", \"$1\", \"namespace\", \"(.*)\") or label_replace(rate(etcd_kubernetes_events_count{exported_namespace=~\"$namespace\", cluster_id=~\"$cluster\"}[1h]), \"target_namespace\", \"$1\", \"exported_namespace\", \"(.*)\")) by (target_namespace) / 2 ",
"hide": false,
"instant": false,
"legendFormat": "{{exported_namespace}}",
"legendFormat": "{{target_namespace}}",
"range": true,
"refId": "B"
}
Expand Down Expand Up @@ -501,7 +501,7 @@
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(etcd_kubernetes_events_count{cluster_id=\"$cluster\",exported_namespace=~\"$namespace\"}) by (kind)",
"expr": "sum(label_replace(etcd_kubernetes_events_count{cluster_id=\"$cluster\",exported_namespace=~\"$namespace\"}, \"target_namespace\", \"$1\", \"exported_namespace\", \"(.*)\") or label_replace(etcd_kubernetes_events_count{cluster_id=\"$cluster\",namespace=~\"$namespace\"}, \"target_namespace\", \"$1\", \"namespace\", \"(.*)\")) by (kind) / 2",
"hide": false,
"instant": false,
"legendFormat": "{{kind}}",
Expand Down Expand Up @@ -597,7 +597,7 @@
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(etcd_kubernetes_events_count{cluster_id=\"$cluster\",exported_namespace=~\"$namespace\"}) by (reason)",
"expr": "sum(label_replace(etcd_kubernetes_events_count{cluster_id=\"$cluster\",exported_namespace=~\"$namespace\"}, \"target_namespace\", \"$1\", \"exported_namespace\", \"(.*)\") or label_replace(etcd_kubernetes_events_count{cluster_id=\"$cluster\",namespace=~\"$namespace\"}, \"target_namespace\", \"$1\", \"namespace\", \"(.*)\")) by (reason) / 2",
"hide": false,
"instant": false,
"legendFormat": "{{reason}}",
Expand Down Expand Up @@ -693,10 +693,10 @@
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(etcd_kubernetes_events_count{cluster_id=\"$cluster\",exported_namespace=~\"$namespace\"}) by (exported_namespace)",
"expr": "sum(label_replace(etcd_kubernetes_events_count{cluster_id=\"$cluster\",exported_namespace=~\"$namespace\"}, \"target_namespace\", \"$1\", \"exported_namespace\", \"(.*)\") or label_replace(etcd_kubernetes_events_count{cluster_id=\"$cluster\",namespace=~\"$namespace\"}, \"target_namespace\", \"$1\", \"namespace\", \"(.*)\")) by (reason) / 2",
"hide": false,
"instant": false,
"legendFormat": "{{exported_namespace}}",
"legendFormat": "{{target_namespace}}",
"range": true,
"refId": "B"
}
Expand Down

0 comments on commit 451a426

Please sign in to comment.