{
  "uid": "fynd",
  "title": "Fynd",
  "editable": true,
  "time": { "from": "now-15m", "to": "now" },
  "refresh": "5s",
  "templating": { "list": [] },
  "panels": [
    {
      "id": 1,
      "title": "Solve Duration (p50 / p95 / p99)",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "worker_router_solve_duration_seconds{quantile=\"0.5\"}",
          "legendFormat": "p50",
          "refId": "A"
        },
        {
          "expr": "worker_router_solve_duration_seconds{quantile=\"0.95\"}",
          "legendFormat": "p95",
          "refId": "B"
        },
        {
          "expr": "worker_router_solve_duration_seconds{quantile=\"0.99\"}",
          "legendFormat": "p99",
          "refId": "C"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": { "drawStyle": "line", "fillOpacity": 10 }
        },
        "overrides": []
      }
    },
    {
      "id": 2,
      "title": "Request Rate",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "sum(rate(worker_router_orders_total[1m]))",
          "legendFormat": "requests/s",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "custom": { "drawStyle": "line", "fillOpacity": 10 }
        },
        "overrides": []
      }
    },
    {
      "id": 3,
      "title": "Orders by Status",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "sum(rate(worker_router_orders_total[1m])) by (status)",
          "legendFormat": "{{status}}",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "custom": { "drawStyle": "line", "fillOpacity": 10 }
        },
        "overrides": []
      }
    },
    {
      "id": 4,
      "title": "Solver Responses per Order (p50 / p95)",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "worker_router_solver_responses{quantile=\"0.5\"}",
          "legendFormat": "p50",
          "refId": "A"
        },
        {
          "expr": "worker_router_solver_responses{quantile=\"0.95\"}",
          "legendFormat": "p95",
          "refId": "B"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": { "drawStyle": "line", "fillOpacity": 10 }
        },
        "overrides": []
      }
    },
    {
      "id": 5,
      "title": "Solver Failures by Pool / Error",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 16 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "sum(rate(worker_router_solver_failures_total[1m])) by (pool, error_type)",
          "legendFormat": "{{pool}} — {{error_type}}",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "custom": { "drawStyle": "bars", "fillOpacity": 50 }
        },
        "overrides": []
      }
    },
    {
      "id": 6,
      "title": "Simulation Coverage (%)",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 16 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "algorithm_simulation_coverage_pct{quantile=\"0.5\"}",
          "legendFormat": "p50",
          "refId": "A"
        },
        {
          "expr": "algorithm_simulation_coverage_pct{quantile=\"0.95\"}",
          "legendFormat": "p95",
          "refId": "B"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "custom": { "drawStyle": "line", "fillOpacity": 10 }
        },
        "overrides": []
      }
    },
    {
      "id": 7,
      "title": "Gas Price Update Lag",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 24 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "gas_price_update_lag_ms",
          "legendFormat": "lag",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ms",
          "custom": { "drawStyle": "line", "fillOpacity": 10 }
        },
        "overrides": []
      }
    },
    {
      "id": 8,
      "title": "Early Returns & Scoring/Simulation Failures",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 24 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "sum(rate(worker_router_early_returns_total[1m]))",
          "legendFormat": "early returns",
          "refId": "A"
        },
        {
          "expr": "sum(rate(algorithm_scoring_failures[1m]))",
          "legendFormat": "scoring failures",
          "refId": "B"
        },
        {
          "expr": "sum(rate(algorithm_simulation_failures[1m]))",
          "legendFormat": "simulation failures",
          "refId": "C"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "custom": { "drawStyle": "line", "fillOpacity": 10 }
        },
        "overrides": []
      }
    },
    {
      "id": 9,
      "title": "Best Solution Pool Distribution",
      "type": "piechart",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 32 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "sum(increase(worker_router_best_solution_pool[5m])) by (pool)",
          "legendFormat": "{{pool}}",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      }
    }
  ],
  "schemaVersion": 39
}
