{
  "description": "Comprehensive database performance monitoring for PostgreSQL, Redis, and RabbitMQ",
  "tags": ["database", "postgresql", "redis", "rabbitmq", "performance"],
  "name": "bakery-ia-database-performance",
  "title": "Bakery IA - Database Performance",
  "uploadedGrafana": false,
  "uuid": "bakery-ia-db-01",
  "version": "v4",
  "collapsableRowsMigrated": true,
  "layout": [
    {
      "x": 0,
      "y": 0,
      "w": 6,
      "h": 3,
      "i": "pg-connections",
      "moved": false,
      "static": false
    },
    {
      "x": 6,
      "y": 0,
      "w": 6,
      "h": 3,
      "i": "pg-db-size",
      "moved": false,
      "static": false
    },
    {
      "x": 0,
      "y": 3,
      "w": 6,
      "h": 3,
      "i": "redis-connected-clients",
      "moved": false,
      "static": false
    },
    {
      "x": 6,
      "y": 3,
      "w": 6,
      "h": 3,
      "i": "redis-memory",
      "moved": false,
      "static": false
    },
    {
      "x": 0,
      "y": 6,
      "w": 6,
      "h": 3,
      "i": "rabbitmq-messages",
      "moved": false,
      "static": false
    },
    {
      "x": 6,
      "y": 6,
      "w": 6,
      "h": 3,
      "i": "rabbitmq-consumers",
      "moved": false,
      "static": false
    }
  ],
  "variables": {
    "database": {
      "id": "database-var",
      "name": "database",
      "description": "Filter by PostgreSQL database name",
      "type": "QUERY",
      "queryValue": "SELECT DISTINCT(resource_attrs['postgresql.database.name']) as value FROM signoz_metrics.distributed_time_series_v4_1day WHERE metric_name = 'postgresql.db_size' AND value != '' ORDER BY value",
      "customValue": "",
      "textboxValue": "",
      "showALLOption": true,
      "multiSelect": false,
      "order": 1,
      "modificationUUID": "",
      "sort": "ASC",
      "selectedValue": null
    }
  },
  "widgets": [
    {
      "id": "pg-connections",
      "title": "PostgreSQL - Active Connections",
      "description": "Number of active PostgreSQL connections",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "metrics",
              "queryName": "A",
              "aggregateOperator": "sum",
              "aggregateAttribute": {
                "key": "postgresql.backends",
                "dataType": "float64",
                "type": "Gauge",
                "isColumn": false
              },
              "timeAggregation": "latest",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [
                  {
                    "key": {
                      "key": "postgresql.database.name",
                      "dataType": "string",
                      "type": "resource",
                      "isColumn": false
                    },
                    "op": "=",
                    "value": "{{.database}}"
                  }
                ],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "postgresql.database.name",
                  "dataType": "string",
                  "type": "resource",
                  "isColumn": false
                }
              ],
              "legend": "{{postgresql.database.name}}",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    },
    {
      "id": "pg-db-size",
      "title": "PostgreSQL - Database Size",
      "description": "Size of PostgreSQL databases in bytes",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "metrics",
              "queryName": "A",
              "aggregateOperator": "sum",
              "aggregateAttribute": {
                "key": "postgresql.db_size",
                "dataType": "int64",
                "type": "Gauge",
                "isColumn": false
              },
              "timeAggregation": "latest",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [
                  {
                    "key": {
                      "key": "postgresql.database.name",
                      "dataType": "string",
                      "type": "resource",
                      "isColumn": false
                    },
                    "op": "=",
                    "value": "{{.database}}"
                  }
                ],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "postgresql.database.name",
                  "dataType": "string",
                  "type": "resource",
                  "isColumn": false
                }
              ],
              "legend": "{{postgresql.database.name}}",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "bytes"
    },
    {
      "id": "redis-connected-clients",
      "title": "Redis - Connected Clients",
      "description": "Number of clients connected to Redis",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "metrics",
              "queryName": "A",
              "aggregateOperator": "avg",
              "aggregateAttribute": {
                "key": "redis.clients.connected",
                "dataType": "int64",
                "type": "Gauge",
                "isColumn": false
              },
              "timeAggregation": "latest",
              "spaceAggregation": "avg",
              "functions": [],
              "filters": {
                "items": [],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "host.name",
                  "dataType": "string",
                  "type": "resource",
                  "isColumn": false
                }
              ],
              "legend": "{{host.name}}",
              "reduceTo": "avg"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    },
    {
      "id": "redis-memory",
      "title": "Redis - Memory Usage",
      "description": "Redis memory usage in bytes",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "metrics",
              "queryName": "A",
              "aggregateOperator": "avg",
              "aggregateAttribute": {
                "key": "redis.memory.used",
                "dataType": "int64",
                "type": "Gauge",
                "isColumn": false
              },
              "timeAggregation": "latest",
              "spaceAggregation": "avg",
              "functions": [],
              "filters": {
                "items": [],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "host.name",
                  "dataType": "string",
                  "type": "resource",
                  "isColumn": false
                }
              ],
              "legend": "{{host.name}}",
              "reduceTo": "avg"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "bytes"
    },
    {
      "id": "rabbitmq-messages",
      "title": "RabbitMQ - Current Messages",
      "description": "Number of messages currently in RabbitMQ queues",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "metrics",
              "queryName": "A",
              "aggregateOperator": "sum",
              "aggregateAttribute": {
                "key": "rabbitmq.message.current",
                "dataType": "int64",
                "type": "Gauge",
                "isColumn": false
              },
              "timeAggregation": "latest",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "queue",
                  "dataType": "string",
                  "type": "tag",
                  "isColumn": false
                }
              ],
              "legend": "Queue: {{queue}}",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    },
    {
      "id": "rabbitmq-consumers",
      "title": "RabbitMQ - Consumer Count",
      "description": "Number of consumers per queue",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "metrics",
              "queryName": "A",
              "aggregateOperator": "sum",
              "aggregateAttribute": {
                "key": "rabbitmq.consumer.count",
                "dataType": "int64",
                "type": "Gauge",
                "isColumn": false
              },
              "timeAggregation": "latest",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "queue",
                  "dataType": "string",
                  "type": "tag",
                  "isColumn": false
                }
              ],
              "legend": "Queue: {{queue}}",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    }
  ]
}
