{
  "__inputs": [
    {
      "name": "DS_VICTORIALOGS",
      "label": "VictoriaLogs",
      "description": "",
      "type": "datasource",
      "pluginId": "victoriametrics-logs-datasource",
      "pluginName": "VictoriaLogs"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "12.1.2"
    },
    {
      "type": "panel",
      "id": "logs",
      "name": "Logs",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "victoriametrics-logs-datasource",
      "name": "VictoriaLogs",
      "version": "0.32.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "id": 5,
      "type": "text",
      "title": "",
      "description": "",
      "gridPos": {
        "h": 9,
        "w": 5,
        "x": 0,
        "y": 0
      },
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "options": {
        "code": {
          "language": "plaintext",
          "showLineNumbers": false,
          "showMiniMap": false
        },
        "content": "## 🧭 快速使用\n\n### 先筛选\n- **节点**：仅显示 `mongodb-*`\n- **慢查询耗时**：默认 `1000 ms`\n- **库表**：按 `ns` 过滤，`All` 表示不过滤\n- **内容搜索**：输入什么，就按一个完整连续文本进行字面匹配\n\n### 内容搜索示例\n\n**普通关键词 / ID：**\n```text\ndepartmentRelation\n612A1D75\naccountId\n```\n\n**JSON 连续片段：**\n```text\n\"departmentRelation\",\"cursor\"\n```\n\n**带冒号、双引号、逗号的片段：**\n```text\nqueryHash\":\"02DA5049\",\"\n```\n\n以上内容都会被当成**一个整体**搜索，不会把 `,`、`:`、`\"`、`(`、`)` 等字符解释成 LogsQL 语法。\n\n例如输入：\n```text\n\"departmentRelation\",\"cursor\"\n```\n\n实际查询效果等价于：\n```logsql\nattr:'\"departmentRelation\",\"cursor\"'\n```\n\n> `All` 表示不过滤。  \n> 搜索为大小写敏感；需要命中时，输入内容必须在 `attr` 中以相同顺序连续出现。\n\n### 推荐排查顺序\n1. **慢查询次数趋势**：先看异常从什么时候开始、哪些库表最突出\n2. **慢查询明细**：默认按耗时降序，优先看最慢记录\n3. **库表慢查询概览**：看慢查询数量、COLLSCAN 占比、最大/最小/平均耗时及扫描量\n4. **高扫描量慢查询 TOP 50**：定位扫描放大最严重的具体查询\n\n### ⚠️ 查询与返回限制\n- 最大建议查询范围：**24h**\n- **原始慢日志 / 慢查询明细：单次最多返回 500 条**\n- 慢查询明细的耗时排序基于这批最多 500 条返回结果\n- **库表慢查询概览：500 限制的是聚合结果行数，不是只统计 500 条原始日志**\n- **高扫描量慢查询：服务端直接排序并返回 TOP 50**\n- 建议优先使用：`30m / 1h / 3h / 6h`\n",
        "mode": "markdown"
      },
      "pluginVersion": "12.1.2",
      "targets": []
    },
    {
      "id": 1,
      "type": "logs",
      "title": "原始慢日志（最新500条）",
      "description": "查看完整 MongoDB Slow query 原始日志，用于核对 command、attr、查询条件及上下文。“内容搜索”会把输入内容作为一个完整连续文本进行字面匹配，不解释其中的逗号、冒号、双引号、括号等特殊符号。默认按时间倒序，单次最多返回最新 500 条。",
      "gridPos": {
        "h": 9,
        "w": 19,
        "x": 5,
        "y": 0
      },
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "options": {
        "dedupStrategy": "none",
        "enableInfiniteScrolling": false,
        "enableLogDetails": true,
        "prettifyLogMessage": false,
        "showCommonLabels": false,
        "showControls": false,
        "showFieldSelector": false,
        "showLabels": false,
        "showLevel": true,
        "showTime": true,
        "sortOrder": "Descending",
        "timestampResolution": "ms",
        "unwrappedColumns": false,
        "wrapLogMessage": true
      },
      "pluginVersion": "12.1.2",
      "targets": [
        {
          "direction": "desc",
          "editorMode": "code",
          "expr": "job:=\"$job\" ns:\"$attrNs\" durationMillis:>$durationThreshold attr:${attrKeyword:singlequote} _msg:${attrKeyword:singlequote}",
          "maxLines": 500,
          "queryType": "instant",
          "datasource": {
            "type": "victoriametrics-logs-datasource",
            "uid": "${DS_VICTORIALOGS}"
          },
          "refId": "A",
          "hide": false
        }
      ],
      "datasource": {
        "type": "victoriametrics-logs-datasource",
        "uid": "${DS_VICTORIALOGS}"
      }
    },
    {
      "id": 3,
      "type": "timeseries",
      "title": "慢查询次数趋势",
      "description": "按时间桶统计慢查询数量，并按库表（ns）拆分曲线；“总计”表示该时间桶内全部慢查询数量。先看是否存在明显峰值或持续抬升，再观察是哪条库表曲线贡献最大。若某个库表在异常时间段持续升高，可结合“慢查询明细”和“库表慢查询概览”继续定位具体查询及执行计划。",
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 9
      },
      "fieldConfig": {
        "defaults": {
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "value": 0,
                "color": "green"
              },
              {
                "value": 80,
                "color": "red"
              }
            ]
          },
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "barWidthFactor": 0.6,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "showValues": false,
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${__field.labels.ns}"
              },
              {
                "id": "custom.lineWidth",
                "value": 2
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "total"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "总计"
              }
            ]
          }
        ]
      },
      "options": {
        "annotations": {
          "clustering": -1,
          "multiLane": false
        },
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "enableFacetedFilter": false,
          "overflow": "ellipsis",
          "placement": "right",
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "hideZeros": false,
          "mode": "multi",
          "sort": "desc"
        }
      },
      "pluginVersion": "12.1.2",
      "targets": [
        {
          "editorMode": "code",
          "expr": "job:=\"$job\" durationMillis:>$durationThreshold attr:${attrKeyword:singlequote}\r\n| filter ns:~\"^(${attrNs:pipe})$\"\r\n| stats by (_time:$__interval, ns) count() as value_by_ns",
          "queryType": "statsRange",
          "datasource": {
            "type": "victoriametrics-logs-datasource",
            "uid": "${DS_VICTORIALOGS}"
          },
          "refId": "A",
          "hide": false
        },
        {
          "editorMode": "code",
          "expr": "job:=\"$job\" durationMillis:>$durationThreshold attr:${attrKeyword:singlequote}\r\n| filter ns:~\"^(${attrNs:pipe})$\"\r\n| stats by (_time:$__interval) count() as total",
          "queryType": "statsRange",
          "datasource": {
            "type": "victoriametrics-logs-datasource",
            "uid": "${DS_VICTORIALOGS}"
          },
          "refId": "B",
          "hide": false
        }
      ],
      "datasource": {
        "type": "victoriametrics-logs-datasource",
        "uid": "${DS_VICTORIALOGS}"
      }
    },
    {
      "id": 2,
      "type": "table",
      "title": "慢查询明细（最多500条 · 默认按耗时降序）",
      "description": "当前筛选范围单次最多返回 500 条慢查询，并在这批返回结果中默认按耗时从高到低排序。“内容搜索”按完整连续文本字面匹配，可直接粘贴 ID、字段名或 JSON 片段。当时间范围内实际慢查询超过 500 条时，本面板不代表整个时间范围内绝对最慢的 500 条。",
      "gridPos": {
        "h": 11,
        "w": 24,
        "x": 0,
        "y": 19
      },
      "fieldConfig": {
        "defaults": {
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "value": 0,
                "color": "green"
              },
              {
                "value": 1000,
                "color": "super-light-orange"
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "left",
            "cellOptions": {
              "type": "auto"
            },
            "footer": {
              "reducers": []
            },
            "inspect": true
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "库表"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 264
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "耗时(ms)"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "from": 1000,
                      "result": {
                        "color": "semi-dark-yellow",
                        "index": 0
                      },
                      "to": 3000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 3000,
                      "result": {
                        "color": "semi-dark-orange",
                        "index": 1
                      },
                      "to": 5000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 5000,
                      "result": {
                        "color": "semi-dark-red",
                        "index": 2
                      },
                      "to": 10000000
                    },
                    "type": "range"
                  }
                ]
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "custom.width",
                "value": 117
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "原始命令内容"
            },
            "properties": [
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "json-view"
                }
              },
              {
                "id": "custom.width",
                "value": 428
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "查询执行方式"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 322
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "总条数"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "时间"
            },
            "properties": [
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": 0
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 223
              },
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "库表"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "耗时(ms)"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "扫描文档数"
            },
            "properties": []
          }
        ]
      },
      "options": {
        "cellHeight": "sm",
        "enablePagination": true,
        "minColumnWidth": 100,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "12.1.2",
      "targets": [
        {
          "direction": "desc",
          "editorMode": "code",
          "expr": "job:=\"$job\" durationMillis:>$durationThreshold ns:\"$attrNs\" attr:${attrKeyword:singlequote}",
          "maxLines": 500,
          "queryType": "instant",
          "datasource": {
            "type": "victoriametrics-logs-datasource",
            "uid": "${DS_VICTORIALOGS}"
          },
          "refId": "A",
          "hide": false
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Line": true,
              "detected_level": true
            },
            "includeByName": {},
            "indexByName": {},
            "orderByMode": "manual",
            "renameByName": {
              "Line": "",
              "Time": "",
              "labels": ""
            }
          }
        },
        {
          "id": "extractFields",
          "options": {
            "delimiter": ",",
            "source": "labels"
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "byVariable": false,
            "include": {
              "pattern": "^Time$|^durationMillis$|^ns$|^planSummary$|^reslen$|^docsExamined$|^attr$"
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "includeByName": {},
            "indexByName": {
              "Time": 0,
              "attr": 3,
              "docsExamined": 5,
              "durationMillis": 2,
              "ns": 1,
              "planSummary": 4,
              "reslen": 6
            },
            "renameByName": {
              "Time": "时间",
              "attr": "原始命令内容",
              "command": "原始命令内容",
              "docsExamined": "扫描文档数",
              "durationMillis": "耗时(ms)",
              "ns": "库表",
              "planSummary": "查询执行方式",
              "reslen": "响应字节"
            }
          }
        },
        {
          "id": "convertFieldType",
          "options": {
            "conversions": [
              {
                "destinationType": "number",
                "targetField": "耗时(ms)"
              },
              {
                "destinationType": "number",
                "targetField": "扫描文档数"
              }
            ],
            "fields": {}
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "耗时(ms)"
              }
            ]
          }
        }
      ],
      "datasource": {
        "type": "victoriametrics-logs-datasource",
        "uid": "${DS_VICTORIALOGS}"
      }
    },
    {
      "id": 4,
      "type": "table",
      "title": "库表慢查询概览",
      "description": "按库表汇总当前筛选范围内的慢查询。\n\nCOLLSCAN 表示 Collection Scan（全集合扫描），即 MongoDB 未通过合适索引快速定位数据，而是扫描集合中的文档进行匹配。\n\n重点关注：\n1. COLLSCAN 占比高：优先检查查询条件是否缺少合适索引；\n2. 最大扫描文档数高：可能存在扫描放大；\n3. 最大耗时高：说明该库表存在较重的慢查询；\n4. COLLSCAN 占比低但仍然很慢：继续检查索引选择性、排序、查询范围及磁盘 IO。\n\n注意：COLLSCAN 并不一定代表异常，小集合或特定查询场景下也可能是正常行为。该面板 maxLines=500 限制的是聚合结果行数（库表数），并不是只统计 500 条原始慢日志。",
      "gridPos": {
        "h": 12,
        "w": 24,
        "x": 0,
        "y": 30
      },
      "fieldConfig": {
        "defaults": {
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "value": 0,
                "color": "green"
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "cellOptions": {
              "type": "auto"
            },
            "footer": {
              "reducers": []
            },
            "inspect": true
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "库表"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              },
              {
                "id": "custom.width",
                "value": 387
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "慢查询数"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "COLLSCAN数"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "COLLSCAN占比(%)"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "from": 0,
                      "result": {
                        "color": "green",
                        "index": 0
                      },
                      "to": 20
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 20,
                      "result": {
                        "color": "yellow",
                        "index": 1
                      },
                      "to": 50
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 50,
                      "result": {
                        "color": "red",
                        "index": 2
                      },
                      "to": 101
                    },
                    "type": "range"
                  }
                ]
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "平均耗时(ms)"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "最大耗时(ms)"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "from": 1000,
                      "result": {
                        "color": "semi-dark-yellow",
                        "index": 0
                      },
                      "to": 3000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 3000,
                      "result": {
                        "color": "semi-dark-orange",
                        "index": 1
                      },
                      "to": 5000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 5000,
                      "result": {
                        "color": "semi-dark-red",
                        "index": 2
                      },
                      "to": 10000000
                    },
                    "type": "range"
                  }
                ]
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "最大扫描文档数"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "from": 0,
                      "result": {
                        "color": "green",
                        "index": 0
                      },
                      "to": 100000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 100000,
                      "result": {
                        "color": "yellow",
                        "index": 1
                      },
                      "to": 500000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 500000,
                      "result": {
                        "color": "semi-dark-orange",
                        "index": 2
                      },
                      "to": 1000000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 1000000,
                      "result": {
                        "color": "semi-dark-red",
                        "index": 3
                      },
                      "to": 1000000000
                    },
                    "type": "range"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "最小耗时(ms)"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          }
        ]
      },
      "options": {
        "cellHeight": "sm",
        "enablePagination": true,
        "minColumnWidth": 110,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "12.1.2",
      "targets": [
        {
          "editorMode": "code",
          "expr": "job:=\"$job\" ns:\"$attrNs\" durationMillis:>$durationThreshold attr:${attrKeyword:singlequote}\n| stats by (ns)\n    count() as slow_cnt,\n    count() if (planSummary:COLLSCAN) as collscan_cnt,\n    avg(durationMillis) as avg_ms,\n    max(durationMillis) as max_ms,\n    min(durationMillis) as min_ms,\n    max(docsExamined) as max_docs\n| math round((collscan_cnt / slow_cnt) * 100) as collscan_pct\n| sort by (slow_cnt) desc",
          "maxLines": 500,
          "queryType": "instant",
          "datasource": {
            "type": "victoriametrics-logs-datasource",
            "uid": "${DS_VICTORIALOGS}"
          },
          "refId": "A",
          "hide": false
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "detected_level": true,
              "streamId": true,
              "streams": true
            },
            "includeByName": {},
            "indexByName": {},
            "renameByName": {}
          }
        },
        {
          "id": "extractFields",
          "options": {
            "delimiter": ",",
            "source": "labels"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Line": true,
              "Time": true,
              "id": true,
              "labels": true,
              "streamId": true,
              "streams": true
            },
            "includeByName": {},
            "indexByName": {
              "ns": 0,
              "slow_cnt": 1,
              "collscan_cnt": 2,
              "collscan_pct": 3,
              "avg_ms": 4,
              "max_ms": 5,
              "min_ms": 6,
              "max_docs": 7
            },
            "orderByMode": "manual",
            "renameByName": {
              "avg_ms": "平均耗时(ms)",
              "collscan_cnt": "COLLSCAN数",
              "collscan_pct": "COLLSCAN占比(%)",
              "max_docs": "最大扫描文档数",
              "max_ms": "最大耗时(ms)",
              "ns": "库表",
              "slow_cnt": "慢查询数",
              "min_ms": "最小耗时(ms)"
            }
          }
        },
        {
          "id": "convertFieldType",
          "options": {
            "conversions": [
              {
                "destinationType": "number",
                "targetField": "慢查询数"
              },
              {
                "destinationType": "number",
                "targetField": "COLLSCAN数"
              },
              {
                "destinationType": "number",
                "targetField": "COLLSCAN占比(%)"
              },
              {
                "destinationType": "number",
                "targetField": "平均耗时(ms)"
              },
              {
                "destinationType": "number",
                "targetField": "最大耗时(ms)"
              },
              {
                "destinationType": "number",
                "targetField": "最大扫描文档数"
              },
              {
                "destinationType": "number",
                "targetField": "最小耗时(ms)"
              }
            ],
            "fields": {}
          }
        }
      ],
      "datasource": {
        "type": "victoriametrics-logs-datasource",
        "uid": "${DS_VICTORIALOGS}"
      }
    },
    {
      "id": 8,
      "type": "table",
      "title": "高扫描量慢查询 TOP 50",
      "description": "按扫描文档数（docsExamined）从高到低，直接展示当前筛选范围内扫描量最大的 50 条慢查询。优先关注“扫描文档数很大但返回结果较少”、同时出现 COLLSCAN、或耗时也明显偏高的记录。这类查询通常需要检查索引是否有效、查询条件是否过宽、是否存在不必要的排序或大范围扫描。本面板由服务端直接排序并取 TOP 50，不受“慢查询明细最多 500 条后再排序”的限制。",
      "gridPos": {
        "h": 13,
        "w": 24,
        "x": 0,
        "y": 42
      },
      "fieldConfig": {
        "defaults": {
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "value": 0,
                "color": "green"
              },
              {
                "value": 1000,
                "color": "super-light-orange"
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": false,
            "footer": {
              "reducers": []
            },
            "inspect": true,
            "wrapHeaderText": false,
            "wrapText": false
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "库表"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 332
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "耗时(ms)"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "from": 1000,
                      "result": {
                        "color": "semi-dark-yellow",
                        "index": 0
                      },
                      "to": 3000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 3000,
                      "result": {
                        "color": "semi-dark-orange",
                        "index": 1
                      },
                      "to": 5000
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 5000,
                      "result": {
                        "color": "semi-dark-red",
                        "index": 2
                      },
                      "to": 10000000
                    },
                    "type": "range"
                  }
                ]
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "原始命令内容"
            },
            "properties": [
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "json-view"
                }
              },
              {
                "id": "custom.width",
                "value": 520
              },
              {
                "id": "custom.align",
                "value": "left"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "查询执行方式"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "总条数"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "时间"
            },
            "properties": [
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": 0
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 217
              },
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "库表"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "耗时(ms)"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "扫描文档数"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              },
              {
                "id": "custom.width",
                "value": 130
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "响应字节"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              },
              {
                "id": "custom.width",
                "value": 149
              }
            ]
          }
        ]
      },
      "options": {
        "cellHeight": "sm",
        "enablePagination": true,
        "minColumnWidth": 100,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "12.1.2",
      "targets": [
        {
          "editorMode": "code",
          "expr": "job:=\"$job\" ns:\"$attrNs\" durationMillis:>$durationThreshold attr:${attrKeyword:singlequote}\n| sort by (docsExamined) desc\n| limit 50",
          "maxLines": 50,
          "queryType": "instant",
          "datasource": {
            "type": "victoriametrics-logs-datasource",
            "uid": "${DS_VICTORIALOGS}"
          },
          "refId": "A",
          "hide": false
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Line": true,
              "detected_level": true
            },
            "includeByName": {},
            "indexByName": {},
            "orderByMode": "manual",
            "renameByName": {
              "Line": "",
              "Time": "",
              "labels": ""
            }
          }
        },
        {
          "id": "extractFields",
          "options": {
            "delimiter": ",",
            "source": "labels"
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "byVariable": false,
            "include": {
              "pattern": "^Time$|^durationMillis$|^ns$|^planSummary$|^reslen$|^docsExamined$|^attr$"
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "includeByName": {},
            "indexByName": {
              "Time": 0,
              "attr": 6,
              "docsExamined": 2,
              "durationMillis": 3,
              "ns": 1,
              "planSummary": 4,
              "reslen": 5
            },
            "renameByName": {
              "Time": "时间",
              "attr": "原始命令内容",
              "command": "原始命令内容",
              "docsExamined": "扫描文档数",
              "durationMillis": "耗时(ms)",
              "ns": "库表",
              "planSummary": "查询执行方式",
              "reslen": "响应字节"
            }
          }
        },
        {
          "id": "convertFieldType",
          "options": {
            "conversions": [
              {
                "destinationType": "number",
                "targetField": "耗时(ms)"
              },
              {
                "destinationType": "number",
                "targetField": "扫描文档数"
              }
            ],
            "fields": {}
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "扫描文档数"
              }
            ]
          }
        }
      ],
      "datasource": {
        "type": "victoriametrics-logs-datasource",
        "uid": "${DS_VICTORIALOGS}"
      }
    }
  ],
  "preload": false,
  "refresh": "10m",
  "schemaVersion": 41,
  "tags": [
    "hap-monitor"
  ],
  "templating": {
    "list": [
      {
        "name": "job",
        "type": "query",
        "label": "节点",
        "description": "",
        "hide": 0,
        "refresh": 2,
        "skipUrlSync": false,
        "datasource": {
          "type": "victoriametrics-logs-datasource",
          "uid": "${DS_VICTORIALOGS}"
        },
        "definition": "job:=\"mongodb-\"*",
        "query": {
          "field": "job",
          "limit": 100,
          "query": "job:=\"mongodb-\"*",
          "refId": "VictoriaLogsVariableQueryEditor-VariableQuery",
          "type": "fieldValue"
        },
        "regex": "",
        "sort": 0,
        "current": {
          "text": "",
          "value": ""
        },
        "options": [],
        "multi": false,
        "includeAll": false,
        "allowCustomValue": false
      },
      {
        "name": "durationThreshold",
        "type": "custom",
        "label": "慢查询耗时",
        "description": "耗时单位毫秒，默认1000ms",
        "hide": 0,
        "skipUrlSync": false,
        "query": "1000",
        "current": {
          "text": "1000",
          "value": "1000"
        },
        "options": [],
        "multi": false,
        "includeAll": false,
        "allowCustomValue": true
      },
      {
        "name": "attrNs",
        "type": "query",
        "label": "库表",
        "description": "例如：mddatapipeline.task_usage_202601（All=空表示不过滤ns），只展示最多40个，请输入指定值查询",
        "hide": 0,
        "refresh": 2,
        "skipUrlSync": false,
        "datasource": {
          "type": "victoriametrics-logs-datasource",
          "uid": "${DS_VICTORIALOGS}"
        },
        "definition": "",
        "query": {
          "field": "ns",
          "limit": 40,
          "query": "",
          "refId": "VictoriaLogsVariableQueryEditor-VariableQuery",
          "type": "fieldValue"
        },
        "regex": "",
        "sort": 0,
        "current": {
          "text": "",
          "value": ""
        },
        "options": [],
        "multi": false,
        "includeAll": true,
        "allowCustomValue": true
      },
      {
        "name": "attrKeyword",
        "type": "custom",
        "label": "内容搜索",
        "description": "输入内容始终按一个完整连续文本进行字面匹配，不解释逗号、冒号、引号、括号等特殊符号。例如输入 \"departmentRelation\",\"cursor\"，会整体搜索这一连续片段；All 表示不过滤。",
        "hide": 0,
        "skipUrlSync": false,
        "query": "",
        "current": {
          "text": "All",
          "value": "$__all"
        },
        "options": [],
        "multi": false,
        "includeAll": true,
        "allowCustomValue": true,
        "allValue": "contains_all(*)"
      }
    ]
  },
  "time": {
    "from": "now-30m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "30s",
      "1m",
      "2m",
      "5m",
      "10m",
      "15m",
      "30m",
      "1h"
    ],
    "hidden": false
  },
  "timezone": "browser",
  "title": "MongoDB 慢查询分析 · VictoriaLogs",
  "uid": "hap-mongodb-victorialogs",
  "version": 1,
  "weekStart": ""
}
