{
  "annotations": {
    "list":[]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "links":[],
  "liveNow": true,
  "panels":[
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 10,
      "panels": [],
      "title": "1. Visión global del clúster (Health Overview)",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "Indica el número de Workers que están enviando 'Heartbeats' al Master. En nuestro laboratorio deben ser 3. Si baja de 3, un contenedor ha caído.",
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 0,
        "y": 1
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "12.4.0",
      "targets":[
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "metrics_master_aliveWorkers_Value",
          "legendFormat": "Workers Vivos",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Workers Activos",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "Total de núcleos de CPU que están siendo utilizados actualmente por las aplicaciones Spark en todo el clúster.",
      "gridPos": {
        "h": 5,
        "w": 9,
        "x": 6,
        "y": 1
      },
      "id": 4,
      "options": {
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true
      },
      "pluginVersion": "12.4.0",
      "targets":[
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(metrics_worker_coresUsed_Value)",
          "legendFormat": "Cores en Uso",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Cores Consumidos (Global)",
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "Memoria RAM total que los Executors han reservado en todos los Workers. Recuerda que configuramos 1GB por Worker en el Docker Compose.",
      "gridPos": {
        "h": 5,
        "w": 9,
        "x": 15,
        "y": 1
      },
      "id": 6,
      "options": {
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true
      },
      "pluginVersion": "12.4.0",
      "targets":[
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(metrics_worker_memUsed_MB_Value)",
          "legendFormat": "RAM en Uso (MB)",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Memoria Consumida (Global)",
      "type": "gauge"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 6
      },
      "id": 12,
      "panels":[],
      "title": "2. Distribución de carga por nodo (Workers)",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "Visualiza cómo se reparte el esfuerzo de CPU. En un entorno sano, las líneas deberían subir juntas, indicando que los datos están bien particionados y todos los nodos trabajan por igual.",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 7
      },
      "id": 8,
      "options": {
        "legend": {
          "calcs":[],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "12.4.0",
      "targets":[
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "metrics_worker_coresUsed_Value",
          "legendFormat": "{{instance}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Uso de CPU por Worker (Cores)",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "RAM asignada a los Executors en cada nodo. Ayuda a detectar si un worker está acaparando toda la memoria (Data Skew).",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 7
      },
      "id": 14,
      "options": {
        "legend": {
          "calcs":[],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "12.4.0",
      "targets":[
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "metrics_worker_memUsed_MB_Value",
          "legendFormat": "{{instance}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Uso de RAM por Worker (MB)",
      "type": "timeseries"
    }
  ],
  "refresh": "10s",
  "schemaVersion": 39,
  "tags":[
    "spark",
    "bda",
    "educacion"
  ],
  "templating": {
    "list":[
      {
        "current": {
          "selected": false,
          "text": "Prometheus",
          "value": "Prometheus"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "DS_PROMETHEUS",
        "options": [],
        "query": "prometheus",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      }
    ]
  },
  "time": {
    "from": "now-15m",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "BDA - Apache Spark 4.x Monitor (Docker Cluster) - Jaime Rabasco",
  "uid": "bda-spark-4x-custom",
  "version": 1
}