{
  "__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": "## 🧭 Quick Start\n\n### Filter First\n- **Node**: Shows only `mongodb-*`\n- **Slow Query Duration**: Default `1000 ms`\n- **Namespace**: Filter by `ns`; `All` means no namespace filter\n- **Content Search**: Whatever you enter is matched literally as one complete continuous string\n\n### Content Search Examples\n\n**Common keyword / ID:**\n```text\ndepartmentRelation\n612A1D75\naccountId\n```\n\n**Continuous JSON fragment:**\n```text\n\"departmentRelation\",\"cursor\"\n```\n\n**Fragment containing a colon, quotation marks, and commas:**\n```text\nqueryHash\":\"02DA5049\",\"\n```\n\nAll of the above are searched as **one complete string**. Commas, colons, quotation marks, and parentheses are not interpreted as LogsQL syntax.\n\nFor example, entering:\n```text\n\"departmentRelation\",\"cursor\"\n```\n\nis equivalent to the following query:\n```logsql\nattr:'\"departmentRelation\",\"cursor\"'\n```\n\n> `All` means no filter.\n> Search is case-sensitive. To match a value, the input must appear continuously in `attr` in the same order.\n\n### Recommended Troubleshooting Order\n1. **Slow Query Trend**: Identify when the issue started and which namespaces stand out\n2. **Slow Query Details**: Results are sorted by duration by default; review the slowest records first\n3. **Namespace Slow Query Overview**: Check slow query count, COLLSCAN percentage, maximum, minimum, and average duration, and scan volume\n4. **Top 50 Slow Queries by Documents Examined**: Locate the specific queries with the most severe scan amplification\n\n### ⚠️ Query and Result Limits\n- Recommended maximum query range: **24h**\n- **Raw slow logs / Slow Query Details: up to 500 entries per query**\n- Slow Query Details sorts by duration within these up to 500 returned entries\n- **Namespace Slow Query Overview: the 500 limit applies to aggregated result rows, not only 500 raw logs**\n- **Top scan queries: sorted directly on the server and returned as TOP 50**\n- Recommended ranges: `30m / 1h / 3h / 6h`",
        "mode": "markdown"
      },
      "pluginVersion": "12.1.2",
      "targets": []
    },
    {
      "id": 1,
      "type": "logs",
      "title": "Raw Slow Logs (Latest 500 Entries)",
      "description": "View complete MongoDB Slow query raw logs to verify commands, attributes, query conditions, and context. Content Search treats the input as one complete continuous string and does not interpret commas, colons, quotation marks, or parentheses as special syntax. Results are sorted by time in descending order, with up to 500 latest entries returned per query.",
      "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": "Slow Query Trend",
      "description": "Counts slow queries by time bucket and splits the trend by namespace (ns). Total represents all slow queries in that time bucket. First check for obvious peaks or a sustained rise, then identify the namespace contributing most to the increase. If a namespace continues to rise during an abnormal period, use Slow Query Details and Namespace Slow Query Overview to locate the specific query and execution plan.",
      "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": "Total"
              }
            ]
          }
        ]
      },
      "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": "Slow Query Details (up to 500 Entries · Sorted by Duration)",
      "description": "Returns up to 500 slow queries in the selected range and sorts this returned result set by duration in descending order. Content Search performs literal matching on a complete continuous string, so IDs, field names, and JSON fragments can be pasted directly. When the time range contains more than 500 slow queries, this panel does not represent the absolute slowest 500 queries in the entire range.",
      "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": "Namespace"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 264
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Duration (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": "Raw Command"
            },
            "properties": [
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "json-view"
                }
              },
              {
                "id": "custom.width",
                "value": 428
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Query Execution Plan"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 322
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Total Count"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Time"
            },
            "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": "Namespace"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Duration (ms)"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Documents Examined"
            },
            "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": "Time",
              "attr": "Raw Command",
              "command": "Raw Command",
              "docsExamined": "Documents Examined",
              "durationMillis": "Duration (ms)",
              "ns": "Namespace",
              "planSummary": "Query Execution Plan",
              "reslen": "Response Bytes"
            }
          }
        },
        {
          "id": "convertFieldType",
          "options": {
            "conversions": [
              {
                "destinationType": "number",
                "targetField": "Duration (ms)"
              },
              {
                "destinationType": "number",
                "targetField": "Documents Examined"
              }
            ],
            "fields": {}
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "Duration (ms)"
              }
            ]
          }
        }
      ],
      "datasource": {
        "type": "victoriametrics-logs-datasource",
        "uid": "${DS_VICTORIALOGS}"
      }
    },
    {
      "id": 4,
      "type": "table",
      "title": "Namespace Slow Query Overview",
      "description": "Aggregates slow queries by namespace in the selected range. COLLSCAN means Collection Scan: MongoDB does not use a suitable index to locate documents quickly and instead scans documents in the collection. Pay attention to a high COLLSCAN percentage, a high maximum documents examined value, or a high maximum duration. A low COLLSCAN percentage with slow queries may still require checking index selectivity, sorting, query range, and disk I/O. COLLSCAN is not always abnormal for small collections or specific query scenarios. The maxLines=500 limit applies to aggregated namespace rows, not the number of raw slow logs counted.",
      "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": "Namespace"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              },
              {
                "id": "custom.width",
                "value": 387
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Slow Query Count"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "COLLSCAN Count"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "COLLSCAN Percentage (%)"
            },
            "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": "Average Duration (ms)"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Maximum Duration (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": "Maximum Documents Examined"
            },
            "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": "Minimum Duration (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": "Average Duration (ms)",
              "collscan_cnt": "COLLSCAN Count",
              "collscan_pct": "COLLSCAN Percentage (%)",
              "max_docs": "Maximum Documents Examined",
              "max_ms": "Maximum Duration (ms)",
              "ns": "Namespace",
              "slow_cnt": "Slow Query Count",
              "min_ms": "Minimum Duration (ms)"
            }
          }
        },
        {
          "id": "convertFieldType",
          "options": {
            "conversions": [
              {
                "destinationType": "number",
                "targetField": "Slow Query Count"
              },
              {
                "destinationType": "number",
                "targetField": "COLLSCAN Count"
              },
              {
                "destinationType": "number",
                "targetField": "COLLSCAN Percentage (%)"
              },
              {
                "destinationType": "number",
                "targetField": "Average Duration (ms)"
              },
              {
                "destinationType": "number",
                "targetField": "Maximum Duration (ms)"
              },
              {
                "destinationType": "number",
                "targetField": "Maximum Documents Examined"
              },
              {
                "destinationType": "number",
                "targetField": "Minimum Duration (ms)"
              }
            ],
            "fields": {}
          }
        }
      ],
      "datasource": {
        "type": "victoriametrics-logs-datasource",
        "uid": "${DS_VICTORIALOGS}"
      }
    },
    {
      "id": 8,
      "type": "table",
      "title": "Top 50 Slow Queries by Documents Examined",
      "description": "Displays the 50 slow queries with the highest documents examined in the selected range, sorted from high to low. Prioritize records with many scanned documents but few returned results, COLLSCAN, or unusually high duration. These queries usually require checking index effectiveness, whether query conditions are too broad, unnecessary sorting, and large-range scans. This panel sorts and limits results directly on the server and is not restricted by the 500-entry limit of Slow Query Details.",
      "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": "Namespace"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 332
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Duration (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": "Raw Command"
            },
            "properties": [
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "json-view"
                }
              },
              {
                "id": "custom.width",
                "value": 520
              },
              {
                "id": "custom.align",
                "value": "left"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Query Execution Plan"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Total Count"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Time"
            },
            "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": "Namespace"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Duration (ms)"
            },
            "properties": []
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Documents Examined"
            },
            "properties": [
              {
                "id": "custom.align",
                "value": "center"
              },
              {
                "id": "custom.width",
                "value": 130
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Response Bytes"
            },
            "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": "Time",
              "attr": "Raw Command",
              "command": "Raw Command",
              "docsExamined": "Documents Examined",
              "durationMillis": "Duration (ms)",
              "ns": "Namespace",
              "planSummary": "Query Execution Plan",
              "reslen": "Response Bytes"
            }
          }
        },
        {
          "id": "convertFieldType",
          "options": {
            "conversions": [
              {
                "destinationType": "number",
                "targetField": "Duration (ms)"
              },
              {
                "destinationType": "number",
                "targetField": "Documents Examined"
              }
            ],
            "fields": {}
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "Documents Examined"
              }
            ]
          }
        }
      ],
      "datasource": {
        "type": "victoriametrics-logs-datasource",
        "uid": "${DS_VICTORIALOGS}"
      }
    }
  ],
  "preload": false,
  "refresh": "10m",
  "schemaVersion": 41,
  "tags": [
    "hap-monitor"
  ],
  "templating": {
    "list": [
      {
        "name": "job",
        "type": "query",
        "label": "Node",
        "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": "Slow Query Duration",
        "description": "Duration in milliseconds, default 1000 ms",
        "hide": 0,
        "skipUrlSync": false,
        "query": "1000",
        "current": {
          "text": "1000",
          "value": "1000"
        },
        "options": [],
        "multi": false,
        "includeAll": false,
        "allowCustomValue": true
      },
      {
        "name": "attrNs",
        "type": "query",
        "label": "Namespace",
        "description": "For example: mddatapipeline.task_usage_202601. All means no namespace filter. Up to 40 namespaces are shown; enter a specific value to query it.",
        "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": "Content Search",
        "description": "The input is always matched literally as one complete continuous string. Commas, colons, quotation marks, and parentheses are not interpreted as special syntax. For example, entering \"departmentRelation\",\"cursor\" searches for this complete continuous fragment. All means no filter.",
        "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 Slow Query Analysis · VictoriaLogs",
  "uid": "hap-mongodb-victorialogs",
  "version": 1,
  "weekStart": ""
}
