ssube/prometheus-sql-adapter

View on GitHub
grafana/cluster/container-limits.json

Summary

Maintainability
Test Coverage
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": 15,
  "iteration": 1576443560488,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$cluster",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "max": false,
        "min": false,
        "show": true,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": false,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": true,
      "steppedLine": false,
      "targets": [
        {
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  CONCAT(labels->>'pod', '/', labels->>'container') AS metric,\n  $__timeGroup(time, ${__interval}),\n  MAX(value) / 100000\nFROM metrics\nWHERE\n  $__timeFilter(time) AND \n  name = 'container_spec_cpu_quota' AND\n  labels ? 'container' AND\n  value > 0\nGROUP BY metric, time_bucket('${__interval}', time)\nORDER BY metric, time_bucket('${__interval}', time);",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "delta_usage"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "agg_container_cpu",
          "timeColumn": "bucket",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Pod CPU Limits",
      "tooltip": {
        "shared": false,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": "cores",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$cluster",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 3,
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "max": false,
        "min": false,
        "show": true,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": false,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": true,
      "steppedLine": false,
      "targets": [
        {
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  CONCAT(labels->>'pod', '/', labels->>'container') AS metric,\n  $__timeGroup(time, ${__interval}),\n  MAX(value) AS value\nFROM metrics\nWHERE\n  $__timeFilter(time) AND \n  name = 'container_spec_memory_limit_bytes' AND\n  labels ? 'container' AND\n  value > 0\nGROUP BY time_bucket('${__interval}', time), metric\nORDER BY time_bucket('${__interval}', time), metric;",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "delta_usage"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "agg_container_cpu",
          "timeColumn": "bucket",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Pod Memory Limits",
      "tooltip": {
        "shared": false,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bytes",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$cluster",
      "description": "Percent of CFS shares over the last minute during which this container was throttled",
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 16,
        "w": 12,
        "x": 0,
        "y": 11
      },
      "id": 7,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": true,
        "hideZero": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "avg",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": true,
      "pointradius": 1,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  CONCAT(labels->>'node', '/', labels->>'pod', '/', labels->>'container_name') AS metric, \n  time_bucket('${__interval}', time) AS time, \n  MAX(value) * 1\nFROM metrics \nWHERE \n  $__timeFilter(time) AND\n  name = 'container_cpu_cfs_throttled_rate_pct' AND \n  labels ? 'container_name' AND\n  value > 0.5\nGROUP BY time_bucket('${__interval}', time), metric \nORDER BY time_bucket('${__interval}', time), metric;",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "delta_usage"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "agg_container_cpu",
          "timeColumn": "bucket",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Container CPU Throttling",
      "tooltip": {
        "shared": false,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "percentunit",
          "label": null,
          "logBase": 1,
          "max": "1",
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "columns": [],
      "datasource": "$cluster",
      "fontSize": "100%",
      "gridPos": {
        "h": 16,
        "w": 12,
        "x": 12,
        "y": 11
      },
      "id": 5,
      "options": {},
      "pageSize": null,
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "decimals": 2,
          "pattern": "/.*/",
          "thresholds": [],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  CONCAT(labels->>'pod', '/', labels->>'container') AS metric,\n  MAX(value) AS value\nFROM metrics\nWHERE\n  $__timeFilter(time) AND \n  name = 'container_spec_memory_limit_bytes' AND\n  labels ? 'container' AND\n  labels->>'container' NOT IN ('POD', 'helper', 'svc-0') AND\n  value = 0\nGROUP BY metric\nORDER BY metric;",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "delta_usage"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "agg_container_cpu",
          "timeColumn": "bucket",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Missing Memory Limits",
      "transform": "table",
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 20,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "text": "monitor-timescale",
          "value": "monitor-timescale"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Cluster",
        "multi": false,
        "name": "cluster",
        "options": [],
        "query": "postgres",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "1m",
      "5m",
      "15m"
    ]
  },
  "timezone": "",
  "title": "Container Limits",
  "uid": "wS_5QbaZk",
  "version": 21
}