{
  "leansignal_demand_export": "1.0",
  "exported_at": "2026-07-17T00:00:00Z",
  "source_tenant": "leansignal-catalog",
  "catalog": {
    "slug": "mysql-otel-demand-extended",
    "integration": "mysql",
    "variant": "extended",
    "title": "MySQL — Extended",
    "category": "Database",
    "dashboards": 1,
    "panels": 14,
    "alerts": 10,
    "docs_url": "https://docs.leansignal.io/integrations/mysql/"
  },
  "demand": {
    "ref": "demand",
    "name": "MySQL — Extended (OpenTelemetry)",
    "description": "Deep InnoDB visibility: buffer-pool page breakdown, sorts, temp resources, and (opt-in) slow queries, connection errors, and replica lag, plus the full alert set.",
    "dashboards": [
      {
        "ref": "dash-mysql",
        "name": "MySQL — Extended",
        "description": "MySQL/InnoDB server metrics from the OpenTelemetry mysqlreceiver — buffer pool, threads, row/handler throughput, locks, and (opt-in) slow queries and replication (extended variant).",
        "data": {
          "display": {
            "name": "MySQL — Extended"
          },
          "panels": {
            "connected_threads": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Connected threads",
                  "description": "Open client connections — compare against your max_connections setting."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "decimal"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint) (mysql_threads{mysql_instance_endpoint=~\"$instance\",kind=\"connected\"})",
                          "seriesNameFormat": "{{mysql_instance_endpoint}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "threads_running": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Threads running",
                  "description": "Threads actively executing — sustained spikes mean contention or overload."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "decimal"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint) (mysql_threads{mysql_instance_endpoint=~\"$instance\",kind=\"running\"})",
                          "seriesNameFormat": "{{mysql_instance_endpoint}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "row_operations_rate": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Row operations",
                  "description": "Rows read/inserted/updated/deleted per second."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "ops/sec"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint, operation) (rate(mysql_row_operations_total{mysql_instance_endpoint=~\"$instance\"}[5m]))",
                          "seriesNameFormat": "{{mysql_instance_endpoint}} · {{operation}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "handler_rate": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Handler operations",
                  "description": "Storage-engine handler calls — the shape of your query workload."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "ops/sec"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint, kind) (rate(mysql_handlers_total{mysql_instance_endpoint=~\"$instance\"}[5m]))",
                          "seriesNameFormat": "{{mysql_instance_endpoint}} · {{kind}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "sorts_rate": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Sorts",
                  "description": "Sort activity — merge passes hitting disk point at an undersized sort buffer."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "ops/sec"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint, kind) (rate(mysql_sorts_total{mysql_instance_endpoint=~\"$instance\"}[5m]))",
                          "seriesNameFormat": "{{mysql_instance_endpoint}} · {{kind}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "slow_queries_rate": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Slow queries (opt-in)",
                  "description": "Queries exceeding long_query_time (enable mysql.query.slow.count on the receiver)."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "counts/sec"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint) (rate(mysql_query_slow_count_total{mysql_instance_endpoint=~\"$instance\"}[5m]))",
                          "seriesNameFormat": "{{mysql_instance_endpoint}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "buffer_pool_hit_ratio": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "InnoDB buffer pool hit ratio",
                  "description": "Reads served from memory — below ~95% the pool is likely undersized."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "percent-decimal"
                      },
                      "min": 0,
                      "max": 1
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "1 - (sum by (mysql_instance_endpoint) (rate(mysql_buffer_pool_operations_total{mysql_instance_endpoint=~\"$instance\",operation=\"reads\"}[5m])) / sum by (mysql_instance_endpoint) (rate(mysql_buffer_pool_operations_total{mysql_instance_endpoint=~\"$instance\",operation=\"read_requests\"}[5m])))",
                          "seriesNameFormat": "{{mysql_instance_endpoint}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "buffer_pool_utilization": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Buffer pool utilization",
                  "description": "Buffer pool bytes in use vs its configured size."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "percent-decimal"
                      },
                      "min": 0,
                      "max": 1
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint) (mysql_buffer_pool_usage_bytes{mysql_instance_endpoint=~\"$instance\"}) / sum by (mysql_instance_endpoint) (mysql_buffer_pool_limit_bytes{mysql_instance_endpoint=~\"$instance\"})",
                          "seriesNameFormat": "{{mysql_instance_endpoint}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "buffer_pool_pages": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Buffer pool pages",
                  "description": "Page inventory (data/free/misc) — persistent free pages mean the pool is oversized."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "decimal"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint, kind) (mysql_buffer_pool_pages{mysql_instance_endpoint=~\"$instance\"})",
                          "seriesNameFormat": "{{mysql_instance_endpoint}} · {{kind}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "dirty_data_pages": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Dirty data pages",
                  "description": "Modified pages awaiting flush — sustained growth means the flusher can’t keep up."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "decimal"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint) (mysql_buffer_pool_data_pages{mysql_instance_endpoint=~\"$instance\",status=\"dirty\"})",
                          "seriesNameFormat": "{{mysql_instance_endpoint}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "row_lock_waits": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "InnoDB row lock waits",
                  "description": "Transactions waiting on row locks — write contention."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "counts/sec"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint) (rate(mysql_row_locks_total{mysql_instance_endpoint=~\"$instance\",kind=\"waits\"}[5m]))",
                          "seriesNameFormat": "{{mysql_instance_endpoint}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "innodb_disk_ops": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "InnoDB disk operations",
                  "description": "Physical reads, writes, and fsyncs."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "ops/sec"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint, operation) (rate(mysql_operations_total{mysql_instance_endpoint=~\"$instance\"}[5m]))",
                          "seriesNameFormat": "{{mysql_instance_endpoint}} · {{operation}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "tmp_resources_rate": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Temporary tables & files",
                  "description": "Temp objects created per second — on-disk temp tables are the expensive ones."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "ops/sec"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (mysql_instance_endpoint, resource) (rate(mysql_tmp_resources_total{mysql_instance_endpoint=~\"$instance\"}[5m]))",
                          "seriesNameFormat": "{{mysql_instance_endpoint}} · {{resource}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "replica_lag": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Replica lag behind source (opt-in)",
                  "description": "Seconds behind source (enable mysql.replica.time_behind_source on the receiver)."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "seconds"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "max by (mysql_instance_endpoint) (mysql_replica_time_behind_source_seconds{mysql_instance_endpoint=~\"$instance\"})",
                          "seriesNameFormat": "{{mysql_instance_endpoint}}"
                        }
                      }
                    }
                  }
                ]
              }
            }
          },
          "layouts": [
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Connections",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/connected_threads"
                    }
                  },
                  {
                    "x": 12,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/threads_running"
                    }
                  }
                ]
              }
            },
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Throughput",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/row_operations_rate"
                    }
                  },
                  {
                    "x": 12,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/handler_rate"
                    }
                  },
                  {
                    "x": 0,
                    "y": 8,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/sorts_rate"
                    }
                  },
                  {
                    "x": 12,
                    "y": 8,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/slow_queries_rate"
                    }
                  }
                ]
              }
            },
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Buffer Pool",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/buffer_pool_hit_ratio"
                    }
                  },
                  {
                    "x": 12,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/buffer_pool_utilization"
                    }
                  },
                  {
                    "x": 0,
                    "y": 8,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/buffer_pool_pages"
                    }
                  },
                  {
                    "x": 12,
                    "y": 8,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/dirty_data_pages"
                    }
                  }
                ]
              }
            },
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Locks",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/row_lock_waits"
                    }
                  }
                ]
              }
            },
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Storage",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/innodb_disk_ops"
                    }
                  },
                  {
                    "x": 12,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/tmp_resources_rate"
                    }
                  }
                ]
              }
            },
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Replication",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/replica_lag"
                    }
                  }
                ]
              }
            }
          ],
          "variables": [
            {
              "kind": "ListVariable",
              "spec": {
                "name": "instance",
                "display": {
                  "name": "Instance"
                },
                "allowAllValue": true,
                "allowMultiple": true,
                "customAllValue": ".*",
                "defaultValue": ".*",
                "plugin": {
                  "kind": "PrometheusLabelValuesVariable",
                  "spec": {
                    "labelName": "mysql_instance_endpoint"
                  }
                }
              }
            }
          ],
          "duration": "1h",
          "refreshInterval": "30s",
          "datasources": {}
        }
      }
    ],
    "alert_rules": [
      {
        "ref": "alert-mysql-instance-restarted",
        "name": "MySQL instance restarted",
        "description": null,
        "query": "mysql_uptime_seconds_total",
        "condition_op": "lt",
        "threshold": 300,
        "interval": "1m",
        "for": "1m",
        "severity": "warning",
        "message": "MySQL {{labels.mysql_instance_endpoint}} uptime is {{value}}s — the server likely restarted in the last 5 minutes.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-high-connections",
        "name": "MySQL high connection count",
        "description": null,
        "query": "sum by (mysql_instance_endpoint) (mysql_threads{kind=\"connected\"})",
        "condition_op": "gt",
        "threshold": 100,
        "interval": "1m",
        "for": "5m",
        "severity": "warning",
        "message": "MySQL {{labels.mysql_instance_endpoint}} has {{value}} connected threads — tune this threshold to ~80% of max_connections.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-low-buffer-pool-hit-ratio",
        "name": "MySQL low buffer pool hit ratio",
        "description": null,
        "query": "1 - (sum by (mysql_instance_endpoint) (rate(mysql_buffer_pool_operations_total{operation=\"reads\"}[5m])) / sum by (mysql_instance_endpoint) (rate(mysql_buffer_pool_operations_total{operation=\"read_requests\"}[5m])))",
        "condition_op": "lt",
        "threshold": 0.95,
        "interval": "1m",
        "for": "10m",
        "severity": "warning",
        "message": "InnoDB buffer pool hit ratio on {{labels.mysql_instance_endpoint}} is {{value}} — the pool may be undersized.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-high-threads-running",
        "name": "MySQL high threads running",
        "description": null,
        "query": "sum by (mysql_instance_endpoint) (avg_over_time(mysql_threads{kind=\"running\"}[10m]))",
        "condition_op": "gt",
        "threshold": 40,
        "interval": "1m",
        "for": "10m",
        "severity": "warning",
        "message": "MySQL {{labels.mysql_instance_endpoint}} averages {{value}} threads running — sustained contention or overload.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-high-row-lock-waits",
        "name": "MySQL high row lock waits",
        "description": null,
        "query": "sum by (mysql_instance_endpoint) (rate(mysql_row_locks_total{kind=\"waits\"}[5m]))",
        "condition_op": "gt",
        "threshold": 10,
        "interval": "1m",
        "for": "5m",
        "severity": "warning",
        "message": "InnoDB row lock waits on {{labels.mysql_instance_endpoint}} at {{value}}/s.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-high-disk-tmp-tables",
        "name": "MySQL high on-disk temp tables",
        "description": null,
        "query": "sum by (mysql_instance_endpoint) (rate(mysql_tmp_resources_total{resource=\"disk_tables\"}[5m]))",
        "condition_op": "gt",
        "threshold": 5,
        "interval": "1m",
        "for": "10m",
        "severity": "warning",
        "message": "MySQL {{labels.mysql_instance_endpoint}} is creating {{value}}/s on-disk temp tables — review queries / tmp_table_size.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-high-disk-reads",
        "name": "MySQL high InnoDB disk reads",
        "description": null,
        "query": "sum by (mysql_instance_endpoint) (rate(mysql_buffer_pool_operations_total{operation=\"reads\"}[5m]))",
        "condition_op": "gt",
        "threshold": 100,
        "interval": "1m",
        "for": "10m",
        "severity": "warning",
        "message": "InnoDB physical reads on {{labels.mysql_instance_endpoint}} at {{value}}/s — the buffer pool may be too small.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-high-slow-queries",
        "name": "MySQL high slow query rate",
        "description": null,
        "query": "sum by (mysql_instance_endpoint) (rate(mysql_query_slow_count_total[5m]))",
        "condition_op": "gt",
        "threshold": 1,
        "interval": "1m",
        "for": "5m",
        "severity": "warning",
        "message": "MySQL {{labels.mysql_instance_endpoint}} slow queries at {{value}}/s (requires enabling mysql.query.slow.count).",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-high-connection-errors",
        "name": "MySQL high connection errors",
        "description": null,
        "query": "sum by (mysql_instance_endpoint) (rate(mysql_connection_errors_total[5m]))",
        "condition_op": "gt",
        "threshold": 1,
        "interval": "1m",
        "for": "5m",
        "severity": "critical",
        "message": "MySQL {{labels.mysql_instance_endpoint}} connection errors at {{value}}/s (requires enabling mysql.connection.errors).",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-mysql-replica-lag-high",
        "name": "MySQL replica lag high",
        "description": null,
        "query": "max by (mysql_instance_endpoint) (mysql_replica_time_behind_source_seconds)",
        "condition_op": "gt",
        "threshold": 30,
        "interval": "1m",
        "for": "5m",
        "severity": "critical",
        "message": "MySQL replica {{labels.mysql_instance_endpoint}} is {{value}}s behind source (requires enabling mysql.replica.time_behind_source).",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      }
    ]
  }
}
