cluster

Infrastructure files for Nordgedanken and Midnightthoughts.
git clone git://archive.git.mtrnord.blog/MTRNord/cluster.git
Log | Files | Refs | README

opencost-namespace.json (49864B)


      1 {
      2   "__inputs": [],
      3   "__requires": [],
      4   "annotations": {
      5     "list": []
      6   },
      7   "description": "A detailed namespace-level cost analysis dashboard that breaks down infrastructure spending by pods, containers, and persistent volumes within a selected namespace. Use this dashboard to understand which workloads are driving costs within a namespace, track cost trends over time, and identify optimization opportunities at the pod and container level. This dashboard is ideal for application teams monitoring their own resource consumption and costs. The dashboards were generated using opencost-mixin. https://github.com/adinhodovic/opencost-mixin. Open issues and create feature requests in the repository.",
      8   "editable": false,
      9   "links": [
     10     {
     11       "asDropdown": false,
     12       "includeVars": false,
     13       "keepTime": true,
     14       "tags": [
     15         "opencost",
     16         "opencost-mixin"
     17       ],
     18       "targetBlank": true,
     19       "title": "OpenCost",
     20       "type": "dashboards"
     21     }
     22   ],
     23   "panels": [
     24     {
     25       "collapsed": false,
     26       "gridPos": {
     27         "h": 1,
     28         "w": 24,
     29         "x": 0,
     30         "y": 0
     31       },
     32       "id": 1,
     33       "title": "Summary",
     34       "type": "row"
     35     },
     36     {
     37       "datasource": {
     38         "type": "prometheus",
     39         "uid": "$datasource"
     40       },
     41       "description": "Current hourly cost rate for the selected namespace, including CPU, RAM, and PV costs. This provides real-time visibility into namespace spending and helps track the immediate impact of workload changes on costs.",
     42       "fieldConfig": {
     43         "defaults": {
     44           "decimals": 2,
     45           "mappings": [],
     46           "thresholds": {
     47             "steps": [
     48               {
     49                 "color": "green",
     50                 "value": 0
     51               }
     52             ]
     53           },
     54           "unit": "currencyUSD"
     55         }
     56       },
     57       "gridPos": {
     58         "h": 3,
     59         "w": 4,
     60         "x": 0,
     61         "y": 1
     62       },
     63       "id": 2,
     64       "options": {
     65         "graphMode": "none",
     66         "percentChangeColorMode": "inverted",
     67         "showPercentChange": true
     68       },
     69       "pluginVersion": "v11.4.0",
     70       "targets": [
     71         {
     72           "datasource": {
     73             "type": "prometheus",
     74             "uid": "${datasource}"
     75           },
     76           "expr": "sum(\n  sum(\n    container_memory_allocation_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_ram_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) / (1024 * 1024 * 1024) * 1\n  )\n)\n\n+\nsum(\n  sum(\n    container_cpu_allocation{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_cpu_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) * 1\n  )\n)\n\n+\nsum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  ) or vector(0)\n) * 1\n\n",
     77           "instant": false
     78         }
     79       ],
     80       "title": "Hourly Cost",
     81       "type": "stat"
     82     },
     83     {
     84       "datasource": {
     85         "type": "prometheus",
     86         "uid": "$datasource"
     87       },
     88       "description": "Total daily cost for the selected namespace. The percentage change indicates cost variance compared to the previous period, helping application teams monitor their daily spending and detect unexpected cost increases.",
     89       "fieldConfig": {
     90         "defaults": {
     91           "decimals": 2,
     92           "mappings": [],
     93           "thresholds": {
     94             "steps": [
     95               {
     96                 "color": "green",
     97                 "value": 0
     98               }
     99             ]
    100           },
    101           "unit": "currencyUSD"
    102         }
    103       },
    104       "gridPos": {
    105         "h": 3,
    106         "w": 4,
    107         "x": 4,
    108         "y": 1
    109       },
    110       "id": 3,
    111       "options": {
    112         "graphMode": "none",
    113         "percentChangeColorMode": "inverted",
    114         "showPercentChange": true
    115       },
    116       "pluginVersion": "v11.4.0",
    117       "targets": [
    118         {
    119           "datasource": {
    120             "type": "prometheus",
    121             "uid": "${datasource}"
    122           },
    123           "expr": "sum(\n  sum(\n    container_memory_allocation_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_ram_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) / (1024 * 1024 * 1024) * 24\n  )\n)\n\n+\nsum(\n  sum(\n    container_cpu_allocation{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_cpu_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) * 24\n  )\n)\n\n+\nsum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  ) or vector(0)\n) * 24\n\n",
    124           "instant": false
    125         }
    126       ],
    127       "title": "Daily Cost",
    128       "type": "stat"
    129     },
    130     {
    131       "datasource": {
    132         "type": "prometheus",
    133         "uid": "$datasource"
    134       },
    135       "description": "Projected monthly cost for the selected namespace based on current hourly rates. Application teams can use this to track their budget allocation and ensure they stay within their cost targets.",
    136       "fieldConfig": {
    137         "defaults": {
    138           "decimals": 2,
    139           "mappings": [],
    140           "thresholds": {
    141             "steps": [
    142               {
    143                 "color": "green",
    144                 "value": 0
    145               }
    146             ]
    147           },
    148           "unit": "currencyUSD"
    149         }
    150       },
    151       "gridPos": {
    152         "h": 3,
    153         "w": 4,
    154         "x": 8,
    155         "y": 1
    156       },
    157       "id": 4,
    158       "options": {
    159         "graphMode": "none",
    160         "percentChangeColorMode": "inverted",
    161         "showPercentChange": true
    162       },
    163       "pluginVersion": "v11.4.0",
    164       "targets": [
    165         {
    166           "datasource": {
    167             "type": "prometheus",
    168             "uid": "${datasource}"
    169           },
    170           "expr": "sum(\n  sum(\n    container_memory_allocation_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_ram_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) / (1024 * 1024 * 1024) * 730\n  )\n)\n\n+\nsum(\n  sum(\n    container_cpu_allocation{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_cpu_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) * 730\n  )\n)\n\n+\nsum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  ) or vector(0)\n) * 730\n\n",
    171           "instant": false
    172         }
    173       ],
    174       "title": "Monthly Cost",
    175       "type": "stat"
    176     },
    177     {
    178       "datasource": {
    179         "type": "prometheus",
    180         "uid": "$datasource"
    181       },
    182       "description": "Projected monthly CPU cost for the selected namespace. Compare this with RAM costs to understand your namespace compute profile and identify if CPU requests are appropriately sized for your workloads.",
    183       "fieldConfig": {
    184         "defaults": {
    185           "decimals": 2,
    186           "mappings": [],
    187           "thresholds": {
    188             "steps": [
    189               {
    190                 "color": "green",
    191                 "value": 0
    192               }
    193             ]
    194           },
    195           "unit": "currencyUSD"
    196         }
    197       },
    198       "gridPos": {
    199         "h": 3,
    200         "w": 4,
    201         "x": 12,
    202         "y": 1
    203       },
    204       "id": 5,
    205       "options": {
    206         "graphMode": "none",
    207         "percentChangeColorMode": "inverted",
    208         "showPercentChange": true
    209       },
    210       "pluginVersion": "v11.4.0",
    211       "targets": [
    212         {
    213           "datasource": {
    214             "type": "prometheus",
    215             "uid": "${datasource}"
    216           },
    217           "expr": "sum(\n  sum(\n    container_cpu_allocation{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_cpu_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) * 730\n  )\n)\n",
    218           "instant": false
    219         }
    220       ],
    221       "title": "Monthly CPU Cost",
    222       "type": "stat"
    223     },
    224     {
    225       "datasource": {
    226         "type": "prometheus",
    227         "uid": "$datasource"
    228       },
    229       "description": "Projected monthly RAM cost for the selected namespace. High memory costs may indicate opportunities to optimize container memory requests or identify memory-intensive workloads that could benefit from tuning.",
    230       "fieldConfig": {
    231         "defaults": {
    232           "decimals": 2,
    233           "mappings": [],
    234           "thresholds": {
    235             "steps": [
    236               {
    237                 "color": "green",
    238                 "value": 0
    239               }
    240             ]
    241           },
    242           "unit": "currencyUSD"
    243         }
    244       },
    245       "gridPos": {
    246         "h": 3,
    247         "w": 4,
    248         "x": 16,
    249         "y": 1
    250       },
    251       "id": 6,
    252       "options": {
    253         "graphMode": "none",
    254         "percentChangeColorMode": "inverted",
    255         "showPercentChange": true
    256       },
    257       "pluginVersion": "v11.4.0",
    258       "targets": [
    259         {
    260           "datasource": {
    261             "type": "prometheus",
    262             "uid": "${datasource}"
    263           },
    264           "expr": "sum(\n  sum(\n    container_memory_allocation_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_ram_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) / (1024 * 1024 * 1024) * 730\n  )\n)\n",
    265           "instant": false
    266         }
    267       ],
    268       "title": "Monthly Ram Cost",
    269       "type": "stat"
    270     },
    271     {
    272       "datasource": {
    273         "type": "prometheus",
    274         "uid": "$datasource"
    275       },
    276       "description": "Projected monthly Persistent Volume cost for the selected namespace. Monitor this to identify unused PVCs or opportunities to migrate to cheaper storage classes without impacting application performance.",
    277       "fieldConfig": {
    278         "defaults": {
    279           "decimals": 2,
    280           "mappings": [],
    281           "thresholds": {
    282             "steps": [
    283               {
    284                 "color": "green",
    285                 "value": 0
    286               }
    287             ]
    288           },
    289           "unit": "currencyUSD"
    290         }
    291       },
    292       "gridPos": {
    293         "h": 3,
    294         "w": 4,
    295         "x": 20,
    296         "y": 1
    297       },
    298       "id": 7,
    299       "options": {
    300         "graphMode": "none",
    301         "percentChangeColorMode": "inverted",
    302         "showPercentChange": true
    303       },
    304       "pluginVersion": "v11.4.0",
    305       "targets": [
    306         {
    307           "datasource": {
    308             "type": "prometheus",
    309             "uid": "${datasource}"
    310           },
    311           "expr": "sum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  )\n) * 730\n",
    312           "instant": false
    313         }
    314       ],
    315       "title": "Monthly PV Cost",
    316       "type": "stat"
    317     },
    318     {
    319       "datasource": {
    320         "type": "prometheus",
    321         "uid": "$datasource"
    322       },
    323       "description": "Daily cost trend for the selected namespace over time. Use this to track how namespace costs evolve, identify cost spikes related to deployments or scaling events, and validate that cost optimization efforts are effective.",
    324       "fieldConfig": {
    325         "defaults": {
    326           "custom": {
    327             "fillOpacity": 10
    328           },
    329           "unit": "currencyUSD"
    330         }
    331       },
    332       "gridPos": {
    333         "h": 5,
    334         "w": 8,
    335         "x": 0,
    336         "y": 4
    337       },
    338       "id": 8,
    339       "options": {
    340         "legend": {
    341           "calcs": [
    342             "mean",
    343             "max"
    344           ],
    345           "displayMode": "table",
    346           "placement": "right",
    347           "showLegend": true,
    348           "sortBy": "Mean",
    349           "sortDesc": true
    350         },
    351         "tooltip": {
    352           "mode": "multi",
    353           "sort": "desc"
    354         }
    355       },
    356       "pluginVersion": "v11.4.0",
    357       "targets": [
    358         {
    359           "datasource": {
    360             "type": "prometheus",
    361             "uid": "$datasource"
    362           },
    363           "exemplar": false,
    364           "expr": "sum(\n  sum(\n    container_memory_allocation_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_ram_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) / (1024 * 1024 * 1024) * 24\n  )\n)\n\n+\nsum(\n  sum(\n    container_cpu_allocation{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_cpu_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) * 24\n  )\n)\n\n+\nsum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  ) or vector(0)\n) * 24\n\n",
    365           "legendFormat": "Daily Cost"
    366         }
    367       ],
    368       "title": "Daily Cost",
    369       "type": "timeseries"
    370     },
    371     {
    372       "datasource": {
    373         "type": "prometheus",
    374         "uid": "$datasource"
    375       },
    376       "description": "Monthly cost projection trend for the selected namespace. This helps application teams track their projected monthly spending and ensure they remain within their allocated budget throughout the billing period.",
    377       "fieldConfig": {
    378         "defaults": {
    379           "custom": {
    380             "fillOpacity": 10
    381           },
    382           "unit": "currencyUSD"
    383         }
    384       },
    385       "gridPos": {
    386         "h": 5,
    387         "w": 8,
    388         "x": 8,
    389         "y": 4
    390       },
    391       "id": 9,
    392       "options": {
    393         "legend": {
    394           "calcs": [
    395             "mean",
    396             "max"
    397           ],
    398           "displayMode": "table",
    399           "placement": "right",
    400           "showLegend": true,
    401           "sortBy": "Mean",
    402           "sortDesc": true
    403         },
    404         "tooltip": {
    405           "mode": "multi",
    406           "sort": "desc"
    407         }
    408       },
    409       "pluginVersion": "v11.4.0",
    410       "targets": [
    411         {
    412           "datasource": {
    413             "type": "prometheus",
    414             "uid": "$datasource"
    415           },
    416           "exemplar": false,
    417           "expr": "sum(\n  sum(\n    container_memory_allocation_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_ram_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) / (1024 * 1024 * 1024) * 730\n  )\n)\n\n+\nsum(\n  sum(\n    container_cpu_allocation{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_cpu_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) * 730\n  )\n)\n\n+\nsum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  ) or vector(0)\n) * 730\n\n",
    418           "legendFormat": "Monthly Cost"
    419         }
    420       ],
    421       "title": "Monthly Cost",
    422       "type": "timeseries"
    423     },
    424     {
    425       "datasource": {
    426         "type": "prometheus",
    427         "uid": "$datasource"
    428       },
    429       "description": "Monthly cost distribution for the selected namespace across resource types (CPU, RAM, Persistent Volumes). This shows which resource category is the primary cost driver for this namespace, helping teams prioritize their optimization efforts.",
    430       "fieldConfig": {
    431         "defaults": {
    432           "unit": "currencyUSD"
    433         }
    434       },
    435       "gridPos": {
    436         "h": 5,
    437         "w": 8,
    438         "x": 16,
    439         "y": 4
    440       },
    441       "id": 10,
    442       "options": {
    443         "displayLabels": [
    444           "percent"
    445         ],
    446         "legend": {
    447           "displayMode": "table",
    448           "placement": "right",
    449           "showLegend": true,
    450           "values": [
    451             "percent",
    452             "value"
    453           ]
    454         },
    455         "tooltip": {
    456           "mode": "multi",
    457           "sort": "desc"
    458         }
    459       },
    460       "pluginVersion": "v11.4.0",
    461       "targets": [
    462         {
    463           "datasource": {
    464             "type": "prometheus",
    465             "uid": "$datasource"
    466           },
    467           "expr": "sum(\n  sum(\n    container_cpu_allocation{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_cpu_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) * 730\n  )\n)\n",
    468           "instant": true,
    469           "legendFormat": "CPU"
    470         },
    471         {
    472           "datasource": {
    473             "type": "prometheus",
    474             "uid": "$datasource"
    475           },
    476           "expr": "sum(\n  sum(\n    container_memory_allocation_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n    }\n  )\n  by (namespace, instance)\n  * on(instance) group_left()\n  (\n    avg(\n      node_ram_hourly_cost{\n        cluster=\"$cluster\",\njob=\"$job\"\n\n      }\n    ) by (instance) / (1024 * 1024 * 1024) * 730\n  )\n)\n",
    477           "instant": true,
    478           "legendFormat": "RAM"
    479         },
    480         {
    481           "datasource": {
    482             "type": "prometheus",
    483             "uid": "$datasource"
    484           },
    485           "expr": "sum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  )\n) * 730\n",
    486           "instant": true,
    487           "legendFormat": "PV"
    488         }
    489       ],
    490       "title": "Cost by Resource",
    491       "type": "piechart"
    492     },
    493     {
    494       "collapsed": false,
    495       "gridPos": {
    496         "h": 1,
    497         "w": 24,
    498         "x": 0,
    499         "y": 9
    500       },
    501       "id": 11,
    502       "title": "Pod Summary",
    503       "type": "row"
    504     },
    505     {
    506       "datasource": {
    507         "type": "prometheus",
    508         "uid": "$datasource"
    509       },
    510       "description": "Top 10 pods by projected monthly cost (based on current hourly rates) with percentage change compared to 7 days and 30 days ago. Positive percentages indicate cost increases (red), negative percentages indicate cost decreases (green). Use this to identify the most expensive pods in the namespace and track how pod costs change over time, especially after deployments or configuration changes.",
    511       "fieldConfig": {
    512         "defaults": {
    513           "thresholds": {
    514             "steps": [
    515               {
    516                 "color": "green",
    517                 "value": 0
    518               },
    519               {
    520                 "color": "yellow",
    521                 "value": 5
    522               },
    523               {
    524                 "color": "red",
    525                 "value": 10
    526               }
    527             ]
    528           },
    529           "unit": "currencyUSD"
    530         },
    531         "overrides": [
    532           {
    533             "matcher": {
    534               "id": "byName",
    535               "options": "Cost Change vs 7d Ago (%)"
    536             },
    537             "properties": [
    538               {
    539                 "id": "color",
    540                 "value": {
    541                   "mode": "thresholds"
    542                 }
    543               },
    544               {
    545                 "id": "custom.cellOptions",
    546                 "value": {
    547                   "type": "color-background"
    548                 }
    549               },
    550               {
    551                 "id": "unit",
    552                 "value": "percent"
    553               }
    554             ]
    555           },
    556           {
    557             "matcher": {
    558               "id": "byName",
    559               "options": "Cost Change vs 30d Ago (%)"
    560             },
    561             "properties": [
    562               {
    563                 "id": "color",
    564                 "value": {
    565                   "mode": "thresholds"
    566                 }
    567               },
    568               {
    569                 "id": "custom.cellOptions",
    570                 "value": {
    571                   "type": "color-background"
    572                 }
    573               },
    574               {
    575                 "id": "unit",
    576                 "value": "percent"
    577               }
    578             ]
    579           }
    580         ]
    581       },
    582       "gridPos": {
    583         "h": 10,
    584         "w": 18,
    585         "x": 0,
    586         "y": 10
    587       },
    588       "id": 12,
    589       "options": {
    590         "footer": {
    591           "enablePagination": true
    592         },
    593         "sortBy": [
    594           {
    595             "desc": true,
    596             "displayName": "Total Cost (Today)"
    597           }
    598         ]
    599       },
    600       "pluginVersion": "v11.4.0",
    601       "targets": [
    602         {
    603           "datasource": {
    604             "type": "prometheus",
    605             "uid": "$datasource"
    606           },
    607           "expr": "topk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) * 730)\n    )\n  ) by (pod)\n)\n",
    608           "format": "table",
    609           "instant": true
    610         },
    611         {
    612           "datasource": {
    613             "type": "prometheus",
    614             "uid": "$datasource"
    615           },
    616           "expr": "topk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) * 730)\n    )\n  ) by (pod)\n)\n\n/\ntopk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"} offset 7d\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"} offset 7d\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"} offset 7d\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"} offset 7d\n        ) by (instance) * 730)\n    )\n  ) by (pod)\n)\n\n* 100\n- 100\n",
    617           "format": "table",
    618           "instant": true
    619         },
    620         {
    621           "datasource": {
    622             "type": "prometheus",
    623             "uid": "$datasource"
    624           },
    625           "expr": "topk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) * 730)\n    )\n  ) by (pod)\n)\n\n/\ntopk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"} offset 30d\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"} offset 30d\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"} offset 30d\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"} offset 30d\n        ) by (instance) * 730)\n    )\n  ) by (pod)\n)\n\n* 100\n- 100\n",
    626           "format": "table",
    627           "instant": true
    628         }
    629       ],
    630       "title": "Pod Monthly Cost",
    631       "transformations": [
    632         {
    633           "id": "merge"
    634         },
    635         {
    636           "id": "organize",
    637           "options": {
    638             "excludeByName": {
    639               "Time": true,
    640               "job": true
    641             },
    642             "indexByName": {
    643               "Value #A": 1,
    644               "Value #B": 2,
    645               "Value #C": 3,
    646               "pod": 0
    647             },
    648             "renameByName": {
    649               "Value #A": "Monthly Cost",
    650               "Value #B": "Cost Change vs 7d Ago (%)",
    651               "Value #C": "Cost Change vs 30d Ago (%)",
    652               "pod": "Pod"
    653             }
    654           }
    655         }
    656       ],
    657       "type": "table"
    658     },
    659     {
    660       "datasource": {
    661         "type": "prometheus",
    662         "uid": "$datasource"
    663       },
    664       "description": "Top 10 pods by monthly cost showing the distribution of spending across pods in the namespace. This visualization helps identify which pods consume the most resources and whether costs are evenly distributed or concentrated in a few workloads.",
    665       "fieldConfig": {
    666         "defaults": {
    667           "unit": "currencyUSD"
    668         }
    669       },
    670       "gridPos": {
    671         "h": 10,
    672         "w": 6,
    673         "x": 18,
    674         "y": 10
    675       },
    676       "id": 13,
    677       "options": {
    678         "displayLabels": [
    679           "percent"
    680         ],
    681         "legend": {
    682           "displayMode": "table",
    683           "placement": "right",
    684           "showLegend": true,
    685           "values": [
    686             "percent",
    687             "value"
    688           ]
    689         },
    690         "tooltip": {
    691           "mode": "multi",
    692           "sort": "desc"
    693         }
    694       },
    695       "pluginVersion": "v11.4.0",
    696       "targets": [
    697         {
    698           "datasource": {
    699             "type": "prometheus",
    700             "uid": "$datasource"
    701           },
    702           "expr": "topk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, pod)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) * 730)\n    )\n  ) by (pod)\n)\n",
    703           "instant": true,
    704           "legendFormat": "{{ pod }}"
    705         }
    706       ],
    707       "title": "Cost by Pod",
    708       "type": "piechart"
    709     },
    710     {
    711       "collapsed": false,
    712       "gridPos": {
    713         "h": 1,
    714         "w": 24,
    715         "x": 0,
    716         "y": 20
    717       },
    718       "id": 14,
    719       "title": "Container Summary",
    720       "type": "row"
    721     },
    722     {
    723       "datasource": {
    724         "type": "prometheus",
    725         "uid": "$datasource"
    726       },
    727       "description": "Top 10 containers by current monthly cost with percentage change compared to 7 days and 30 days ago. Positive percentages indicate cost increases (red), negative percentages indicate cost decreases (green). This granular view helps identify specific containers within pods that are driving costs, useful for optimizing multi-container pod configurations.",
    728       "fieldConfig": {
    729         "defaults": {
    730           "thresholds": {
    731             "steps": [
    732               {
    733                 "color": "green",
    734                 "value": 0
    735               },
    736               {
    737                 "color": "yellow",
    738                 "value": 5
    739               },
    740               {
    741                 "color": "red",
    742                 "value": 10
    743               }
    744             ]
    745           },
    746           "unit": "currencyUSD"
    747         },
    748         "overrides": [
    749           {
    750             "matcher": {
    751               "id": "byName",
    752               "options": "Cost Change vs 7d Ago (%)"
    753             },
    754             "properties": [
    755               {
    756                 "id": "color",
    757                 "value": {
    758                   "mode": "thresholds"
    759                 }
    760               },
    761               {
    762                 "id": "custom.cellOptions",
    763                 "value": {
    764                   "type": "color-background"
    765                 }
    766               },
    767               {
    768                 "id": "unit",
    769                 "value": "percent"
    770               }
    771             ]
    772           },
    773           {
    774             "matcher": {
    775               "id": "byName",
    776               "options": "Cost Change vs 30d Ago (%)"
    777             },
    778             "properties": [
    779               {
    780                 "id": "color",
    781                 "value": {
    782                   "mode": "thresholds"
    783                 }
    784               },
    785               {
    786                 "id": "custom.cellOptions",
    787                 "value": {
    788                   "type": "color-background"
    789                 }
    790               },
    791               {
    792                 "id": "unit",
    793                 "value": "percent"
    794               }
    795             ]
    796           }
    797         ]
    798       },
    799       "gridPos": {
    800         "h": 10,
    801         "w": 18,
    802         "x": 0,
    803         "y": 21
    804       },
    805       "id": 15,
    806       "options": {
    807         "footer": {
    808           "enablePagination": true
    809         },
    810         "sortBy": [
    811           {
    812             "desc": true,
    813             "displayName": "Monthly Cost"
    814           }
    815         ]
    816       },
    817       "pluginVersion": "v11.4.0",
    818       "targets": [
    819         {
    820           "datasource": {
    821             "type": "prometheus",
    822             "uid": "$datasource"
    823           },
    824           "expr": "topk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) * 730\n      )\n    )\n  ) by (container)\n)\n",
    825           "format": "table",
    826           "instant": true
    827         },
    828         {
    829           "datasource": {
    830             "type": "prometheus",
    831             "uid": "$datasource"
    832           },
    833           "expr": "topk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) * 730\n      )\n    )\n  ) by (container)\n)\n\n/\ntopk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"} offset 7d\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"} offset 7d\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"} offset 7d\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"} offset 7d\n        ) by (instance) * 730\n      )\n    )\n  ) by (container)\n)\n\n* 100\n- 100\n",
    834           "format": "table",
    835           "instant": true
    836         },
    837         {
    838           "datasource": {
    839             "type": "prometheus",
    840             "uid": "$datasource"
    841           },
    842           "expr": "topk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) * 730\n      )\n    )\n  ) by (container)\n)\n\n/\ntopk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"} offset 30d\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"} offset 30d\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"} offset 30d\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"} offset 30d\n        ) by (instance) * 730\n      )\n    )\n  ) by (container)\n)\n\n* 100\n- 100\n",
    843           "format": "table",
    844           "instant": true
    845         }
    846       ],
    847       "title": "Container Monthly Cost",
    848       "transformations": [
    849         {
    850           "id": "merge"
    851         },
    852         {
    853           "id": "organize",
    854           "options": {
    855             "excludeByName": {
    856               "Time": true,
    857               "job": true
    858             },
    859             "indexByName": {
    860               "Value #A": 1,
    861               "Value #B": 2,
    862               "Value #C": 3,
    863               "container": 0
    864             },
    865             "renameByName": {
    866               "Value #A": "Monthly Cost",
    867               "Value #B": "Cost Change vs 7d Ago (%)",
    868               "Value #C": "Cost Change vs 30d Ago (%)",
    869               "container": "Container"
    870             }
    871           }
    872         }
    873       ],
    874       "type": "table"
    875     },
    876     {
    877       "datasource": {
    878         "type": "prometheus",
    879         "uid": "$datasource"
    880       },
    881       "description": "Top 10 containers by monthly cost showing the distribution of spending across containers in the namespace. This helps identify which container images or workload types are most expensive and whether sidecar containers are adding significant costs.",
    882       "fieldConfig": {
    883         "defaults": {
    884           "unit": "currencyUSD"
    885         }
    886       },
    887       "gridPos": {
    888         "h": 10,
    889         "w": 6,
    890         "x": 18,
    891         "y": 21
    892       },
    893       "id": 16,
    894       "options": {
    895         "displayLabels": [
    896           "percent"
    897         ],
    898         "legend": {
    899           "displayMode": "table",
    900           "placement": "right",
    901           "showLegend": true,
    902           "values": [
    903             "percent",
    904             "value"
    905           ]
    906         },
    907         "tooltip": {
    908           "mode": "multi",
    909           "sort": "desc"
    910         }
    911       },
    912       "pluginVersion": "v11.4.0",
    913       "targets": [
    914         {
    915           "datasource": {
    916             "type": "prometheus",
    917             "uid": "$datasource"
    918           },
    919           "expr": "topk(10,\n  sum(\n    (\n      sum(\n        container_memory_allocation_bytes{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_ram_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) / (1024 * 1024 * 1024) * 730\n      )\n    )\n    +\n    (\n      sum(\n        container_cpu_allocation{\n          cluster=\"$cluster\",\n          namespace=\"$namespace\",\n          job=\"$job\"}\n      )\n      by (instance, container)\n      * on(instance) group_left()\n      (\n        avg(\n          node_cpu_hourly_cost{\n            cluster=\"$cluster\",\n            job=\"$job\"}\n        ) by (instance) * 730\n      )\n    )\n  ) by (container)\n)\n",
    920           "instant": true,
    921           "legendFormat": "{{ container }}"
    922         }
    923       ],
    924       "title": "Cost by Container",
    925       "type": "piechart"
    926     },
    927     {
    928       "collapsed": false,
    929       "gridPos": {
    930         "h": 1,
    931         "w": 24,
    932         "x": 0,
    933         "y": 31
    934       },
    935       "id": 17,
    936       "title": "PV Summary",
    937       "type": "row"
    938     },
    939     {
    940       "datasource": {
    941         "type": "prometheus",
    942         "uid": "$datasource"
    943       },
    944       "description": "List of Persistent Volumes used by the selected namespace with their capacity (in GiB) and monthly cost, sorted by total cost. Use this to identify large or expensive volumes that may be candidates for cleanup, resizing, or migration to cheaper storage classes.",
    945       "fieldConfig": {
    946         "defaults": {
    947           "thresholds": {
    948             "steps": []
    949           },
    950           "unit": "decgbytes"
    951         },
    952         "overrides": [
    953           {
    954             "matcher": {
    955               "id": "byName",
    956               "options": "Total Cost"
    957             },
    958             "properties": [
    959               {
    960                 "id": "unit",
    961                 "value": "currencyUSD"
    962               }
    963             ]
    964           }
    965         ]
    966       },
    967       "gridPos": {
    968         "h": 10,
    969         "w": 18,
    970         "x": 0,
    971         "y": 32
    972       },
    973       "id": 18,
    974       "options": {
    975         "footer": {
    976           "enablePagination": true
    977         },
    978         "sortBy": [
    979           {
    980             "desc": true,
    981             "displayName": "Monthly Cost"
    982           }
    983         ]
    984       },
    985       "pluginVersion": "v11.4.0",
    986       "targets": [
    987         {
    988           "datasource": {
    989             "type": "prometheus",
    990             "uid": "$datasource"
    991           },
    992           "expr": "sum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\n      job=\"$job\"\n    } / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace)\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\n        job=\"$job\",\n        namespace=\"$namespace\"\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n) by (persistentvolume)\n",
    993           "format": "table",
    994           "instant": true
    995         },
    996         {
    997           "datasource": {
    998             "type": "prometheus",
    999             "uid": "$datasource"
   1000           },
   1001           "expr": "sum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  )\n) by (persistentvolume) * 730\n",
   1002           "format": "table",
   1003           "instant": true
   1004         }
   1005       ],
   1006       "title": "Persistent Volumes Monthly Cost",
   1007       "transformations": [
   1008         {
   1009           "id": "merge"
   1010         },
   1011         {
   1012           "id": "organize",
   1013           "options": {
   1014             "excludeByName": {
   1015               "Time": true,
   1016               "job": true,
   1017               "namespace": true
   1018             },
   1019             "indexByName": {
   1020               "Value #A": 1,
   1021               "Value #B": 2,
   1022               "persistentvolume": 0
   1023             },
   1024             "renameByName": {
   1025               "Value #A": "Total GiB",
   1026               "Value #B": "Total Cost",
   1027               "persistentvolume": "Persistent Volume"
   1028             }
   1029           }
   1030         }
   1031       ],
   1032       "type": "table"
   1033     },
   1034     {
   1035       "datasource": {
   1036         "type": "prometheus",
   1037         "uid": "$datasource"
   1038       },
   1039       "description": "Distribution of monthly storage costs across Persistent Volumes in the namespace. This shows which volumes consume the most storage budget and helps identify if storage costs are concentrated in a few large volumes or distributed across many smaller ones.",
   1040       "fieldConfig": {
   1041         "defaults": {
   1042           "unit": "currencyUSD"
   1043         }
   1044       },
   1045       "gridPos": {
   1046         "h": 10,
   1047         "w": 6,
   1048         "x": 18,
   1049         "y": 32
   1050       },
   1051       "id": 19,
   1052       "options": {
   1053         "displayLabels": [
   1054           "percent"
   1055         ],
   1056         "legend": {
   1057           "displayMode": "table",
   1058           "placement": "right",
   1059           "showLegend": true,
   1060           "values": [
   1061             "percent",
   1062             "value"
   1063           ]
   1064         },
   1065         "tooltip": {
   1066           "mode": "multi",
   1067           "sort": "desc"
   1068         }
   1069       },
   1070       "pluginVersion": "v11.4.0",
   1071       "targets": [
   1072         {
   1073           "datasource": {
   1074             "type": "prometheus",
   1075             "uid": "$datasource"
   1076           },
   1077           "expr": "sum(\n  sum(\n    kube_persistentvolume_capacity_bytes{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n    / (1024 * 1024 * 1024)\n  ) by (persistentvolume)\n  *\n  sum(\n    pv_hourly_cost{\n      cluster=\"$cluster\",\njob=\"$job\"\n\n    }\n  ) by (persistentvolume)\n  * on(persistentvolume) group_left(cluster, namespace) (\n    label_replace(\n      kube_persistentvolumeclaim_info{\n        cluster=\"$cluster\",\njob=\"$job\"\n,\nnamespace=\"$namespace\"\n\n      },\n      \"persistentvolume\", \"$1\",\n      \"volumename\", \"(.*)\"\n    )\n  )\n) by (persistentvolume) * 730\n",
   1078           "instant": true,
   1079           "legendFormat": "{{ persistentvolume }}"
   1080         }
   1081       ],
   1082       "title": "Cost by Persistent Volume",
   1083       "type": "piechart"
   1084     }
   1085   ],
   1086   "schemaVersion": 39,
   1087   "tags": [
   1088     "opencost",
   1089     "opencost-mixin"
   1090   ],
   1091   "templating": {
   1092     "list": [
   1093       {
   1094         "current": {
   1095           "selected": true,
   1096           "text": "default",
   1097           "value": "default"
   1098         },
   1099         "label": "Data source",
   1100         "name": "datasource",
   1101         "query": "prometheus",
   1102         "type": "datasource"
   1103       },
   1104       {
   1105         "datasource": {
   1106           "type": "prometheus",
   1107           "uid": "${datasource}"
   1108         },
   1109         "hide": 2,
   1110         "label": "Cluster",
   1111         "name": "cluster",
   1112         "query": "label_values(opencost_build_info{}, cluster)",
   1113         "refresh": 2,
   1114         "sort": 1,
   1115         "type": "query"
   1116       },
   1117       {
   1118         "datasource": {
   1119           "type": "prometheus",
   1120           "uid": "${datasource}"
   1121         },
   1122         "includeAll": false,
   1123         "label": "Job",
   1124         "multi": false,
   1125         "name": "job",
   1126         "query": "label_values(opencost_build_info{cluster=\"$cluster\"}, job)",
   1127         "refresh": 2,
   1128         "sort": 1,
   1129         "type": "query"
   1130       },
   1131       {
   1132         "datasource": {
   1133           "type": "prometheus",
   1134           "uid": "${datasource}"
   1135         },
   1136         "includeAll": false,
   1137         "label": "Namespace",
   1138         "multi": false,
   1139         "name": "namespace",
   1140         "query": "label_values(kube_namespace_labels{cluster=\"$cluster\", job=\"$job\"}, namespace)",
   1141         "refresh": 2,
   1142         "sort": 1,
   1143         "type": "query"
   1144       }
   1145     ]
   1146   },
   1147   "time": {
   1148     "from": "now-2d",
   1149     "to": "now"
   1150   },
   1151   "timezone": "utc",
   1152   "title": "OpenCost / Namespace",
   1153   "uid": "opencost-mixin-namespace-jkwq",
   1154   "gnetId": 22252
   1155 }