Ctrl K
ComunidadGuías…

monitoring/grafana-dashboard.json

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
{
  "dashboard": {
    "title": "Actual-Sync Monitoring",
    "tags": ["actual-sync", "monitoring"],
    "timezone": "browser",
    "schemaVersion": 16,
    "version": 1,
    "refresh": "30s",
    "time": {
      "from": "now-6h",
      "to": "now"
    },
    "timepicker": {
      "refresh_intervals": ["10s", "30s", "1m", "5m", "15m", "30m", "1h"]
    },
    "panels": [
      {
        "type": "stat",
        "title": "Total Syncs (24h)",
        "gridPos": {"h": 4, "w": 6, "x": 0, "y": 0},
        "targets": [
          {
            "expr": "increase(actual_sync_total[24h])",
            "legendFormat": "{{server}} - {{status}}"
          }
        ],
        "options": {
          "graphMode": "area",
          "colorMode": "value"
        }
      },
      {
        "type": "stat",
        "title": "Success Rate",
        "gridPos": {"h": 4, "w": 6, "x": 6, "y": 0},
        "targets": [
          {
            "expr": "actual_sync_success_rate",
            "legendFormat": "{{server}}"
          }
        ],
        "options": {
          "graphMode": "area",
          "colorMode": "value",
          "unit": "percentunit"
        },
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {"value": 0, "color": "red"},
            {"value": 0.8, "color": "yellow"},
            {"value": 0.95, "color": "green"}
          ]
        }
      },
      {
        "type": "stat",
        "title": "Accounts Processed (Last Sync)",
        "gridPos": {"h": 4, "w": 6, "x": 12, "y": 0},
        "targets": [
          {
            "expr": "actual_sync_accounts_processed",
            "legendFormat": "{{server}}"
          }
        ],
        "options": {
          "graphMode": "none",
          "colorMode": "value"
        }
      },
      {
        "type": "stat",
        "title": "Accounts Failed (Last Sync)",
        "gridPos": {"h": 4, "w": 6, "x": 18, "y": 0},
        "targets": [
          {
            "expr": "actual_sync_accounts_failed",
            "legendFormat": "{{server}}"
          }
        ],
        "options": {
          "graphMode": "none",
          "colorMode": "value"
        },
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {"value": 0, "color": "green"},
            {"value": 1, "color": "yellow"},
            {"value": 5, "color": "red"}
          ]
        }
      },
      {
        "type": "graph",
        "title": "Sync Duration",
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 4},
        "targets": [
          {
            "expr": "rate(actual_sync_duration_seconds_sum[5m]) / rate(actual_sync_duration_seconds_count[5m])",
            "legendFormat": "{{server}} avg"
          }
        ],
        "yaxes": [
          {
            "format": "s",
            "label": "Duration"
          },
          {
            "format": "short"
          }
        ],
        "lines": true,
        "fill": 1,
        "linewidth": 2,
        "legend": {
          "show": true,
          "values": true,
          "min": true,
          "max": true,
          "current": true,
          "avg": true
        }
      },
      {
        "type": "graph",
        "title": "Sync Rate (per hour)",
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 4},
        "targets": [
          {
            "expr": "rate(actual_sync_total[1h])",
            "legendFormat": "{{server}} - {{status}}"
          }
        ],
        "yaxes": [
          {
            "format": "short",
            "label": "Syncs/hour"
          },
          {
            "format": "short"
          }
        ],
        "lines": true,
        "fill": 1,
        "linewidth": 2,
        "legend": {
          "show": true,
          "values": false
        },
        "stack": true
      },
      {
        "type": "graph",
        "title": "Success vs Failure Count",
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 12},
        "targets": [
          {
            "expr": "actual_sync_total{status=\"success\"}",
            "legendFormat": "{{server}} - Success"
          },
          {
            "expr": "actual_sync_total{status=\"error\"}",
            "legendFormat": "{{server}} - Error"
          }
        ],
        "yaxes": [
          {
            "format": "short",
            "label": "Count"
          },
          {
            "format": "short"
          }
        ],
        "lines": true,
        "fill": 0,
        "linewidth": 2,
        "legend": {
          "show": true,
          "values": true,
          "current": true
        }
      },
      {
        "type": "table",
        "title": "Error Distribution",
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 12},
        "targets": [
          {
            "expr": "sort_desc(sum by (server, error_code) (actual_sync_errors_total))",
            "format": "table",
            "instant": true
          }
        ],
        "transformations": [
          {
            "id": "organize",
            "options": {
              "excludeByName": {
                "Time": true
              },
              "renameByName": {
                "server": "Server",
                "error_code": "Error Code",
                "Value": "Count"
              }
            }
          }
        ],
        "options": {
          "showHeader": true
        }
      },
      {
        "type": "graph",
        "title": "Sync Duration Percentiles",
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 20},
        "targets": [
          {
            "expr": "histogram_quantile(0.50, rate(actual_sync_duration_seconds_bucket[5m]))",
            "legendFormat": "p50 - {{server}}"
          },
          {
            "expr": "histogram_quantile(0.90, rate(actual_sync_duration_seconds_bucket[5m]))",
            "legendFormat": "p90 - {{server}}"
          },
          {
            "expr": "histogram_quantile(0.99, rate(actual_sync_duration_seconds_bucket[5m]))",
            "legendFormat": "p99 - {{server}}"
          }
        ],
        "yaxes": [
          {
            "format": "s",
            "label": "Duration"
          },
          {
            "format": "short"
          }
        ],
        "lines": true,
        "fill": 0,
        "linewidth": 2,
        "legend": {
          "show": true,
          "values": true,
          "current": true,
          "avg": true
        }
      },
      {
        "type": "graph",
        "title": "Time Since Last Successful Sync",
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 20},
        "targets": [
          {
            "expr": "time() - actual_sync_last_sync_timestamp{status=\"success\"}",
            "legendFormat": "{{server}}"
          }
        ],
        "yaxes": [
          {
            "format": "s",
            "label": "Time Since Last Sync"
          },
          {
            "format": "short"
          }
        ],
        "lines": true,
        "fill": 1,
        "linewidth": 2,
        "alert": {
          "conditions": [
            {
              "evaluator": {
                "params": [7200],
                "type": "gt"
              },
              "query": {
                "params": ["A", "5m", "now"]
              },
              "type": "query"
            }
          ],
          "frequency": "60s",
          "handler": 1,
          "name": "Sync Delay Alert",
          "noDataState": "alerting",
          "message": "No successful sync in over 2 hours"
        }
      },
      {
        "type": "graph",
        "title": "Node.js Memory Usage",
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 28},
        "targets": [
          {
            "expr": "process_resident_memory_bytes",
            "legendFormat": "RSS"
          },
          {
            "expr": "nodejs_heap_size_used_bytes",
            "legendFormat": "Heap Used"
          },
          {
            "expr": "nodejs_heap_size_total_bytes",
            "legendFormat": "Heap Total"
          }
        ],
        "yaxes": [
          {
            "format": "bytes",
            "label": "Memory"
          },
          {
            "format": "short"
          }
        ],
        "lines": true,
        "fill": 1,
        "linewidth": 2
      },
      {
        "type": "graph",
        "title": "Node.js Event Loop Lag",
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 28},
        "targets": [
          {
            "expr": "rate(nodejs_eventloop_lag_seconds[1m])",
            "legendFormat": "Event Loop Lag"
          }
        ],
        "yaxes": [
          {
            "format": "s",
            "label": "Lag"
          },
          {
            "format": "short"
          }
        ],
        "lines": true,
        "fill": 1,
        "linewidth": 2,
        "alert": {
          "conditions": [
            {
              "evaluator": {
                "params": [1],
                "type": "gt"
              },
              "query": {
                "params": ["A", "5m", "now"]
              },
              "type": "query"
            }
          ],
          "frequency": "60s",
          "handler": 1,
          "name": "Event Loop Lag Alert",
          "noDataState": "no_data",
          "message": "High event loop lag detected"
        }
      }
    ],
    "templating": {
      "list": [
        {
          "name": "datasource",
          "type": "datasource",
          "query": "prometheus",
          "current": {
            "text": "Prometheus",
            "value": "Prometheus"
          }
        }
      ]
    },
    "annotations": {
      "list": [
        {
          "builtIn": 1,
          "datasource": "-- Grafana --",
          "enable": true,
          "hide": true,
          "iconColor": "rgba(0, 211, 255, 1)",
          "name": "Annotations & Alerts",
          "type": "dashboard"
        }
      ]
    }
  }
}