Grafana dashboard: ModelArts-User-View

用户视图抬头部分展示了当前用户名下的任务数量以及当前用户的资源使用情况，后续分别展示了当前用户最近24小时和最近7天的任务概要信息，包括任务ID、类型、开始时间、运行时长以及CPU、内存、GPU、显存、NPU、NPU内存的使用情况。

{
  "__inputs": [
    {
      "name": "DS_CNEAST3-HRYT",
      "label": "cneast3-hryt",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.1.7"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 58,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${data_source}"
      },
      "description": "用户在当前池中的任务数",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "count"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "任务数"
              },
              {
                "id": "unit",
                "value": "none"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 14,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.1.7",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "count(count by(service_id) (ma_container_cpu_limit_core{pool_id=\"$pool_id\", user_id=\"$user_id\"})) OR vector(0)",
          "format": "time_series",
          "instant": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "title": "任务数",
      "transformations": [
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/(count)[(].*/",
            "renamePattern": "$1"
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${data_source}"
      },
      "description": "用户在当前池中GPU的使用情况",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "count"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "占用卡数"
              },
              {
                "id": "unit",
                "value": "none"
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "blue",
                      "value": null
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*_util$/"
            },
            "properties": [
              {
                "id": "unit"
              },
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 100
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "red",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 50
                    },
                    {
                      "color": "green",
                      "value": 85
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "gpu_util"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "GPU平均利用率"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "mem_util"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "显存平均利用率"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 8,
        "x": 3,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 12,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.1.7",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "count(count by(gpu_uuid) (ma_container_gpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"})) OR on() vector(0)",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg(ma_container_gpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}) OR on() vector(0)",
          "legendFormat": "__auto",
          "range": true,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg(ma_container_gpu_mem_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}) OR on() vector(0)",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "C"
        }
      ],
      "timeFrom": "15m",
      "title": "GPU使用情况",
      "transformations": [
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/(^count)[(].*/",
            "renamePattern": "$1"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/.*(gpu_util)[{].*/",
            "renamePattern": "$1"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/.*(mem_util)[{].*/",
            "renamePattern": "$1"
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${data_source}"
      },
      "description": "用户在当前池中NPU的使用情况",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "count"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "占用卡数"
              },
              {
                "id": "unit",
                "value": "none"
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "blue",
                      "value": null
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*_util$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 100
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "red",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 10
                    },
                    {
                      "color": "green",
                      "value": 85
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "npu_util"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "NPU平均利用率"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "memory_util"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "NPU内存平均利用率"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 8,
        "x": 11,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 13,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.1.7",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "count(count by(node_ip, npu_id) (ma_container_npu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"})) OR on() vector(0)",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg(ma_container_npu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}) OR on() vector(0)",
          "legendFormat": "__auto",
          "range": true,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg(ma_container_npu_memory_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}) OR on() vector(0)",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "C"
        }
      ],
      "timeFrom": "15m",
      "title": "NPU使用情况",
      "transformations": [
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/(^count)[(].*/",
            "renamePattern": "$1"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/.*(npu_util)[{].*/",
            "renamePattern": "$1"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/.*(memory_util)[{].*/",
            "renamePattern": "$1"
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${data_source}"
      },
      "description": "用户在当前池中CPU&内存的使用情况",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*_util$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 100
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "red",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 50
                    },
                    {
                      "color": "green",
                      "value": 85
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "cpu_util"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "CPU平均利用率"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "memory_util"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "内存平均利用率"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 5,
        "x": 19,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 15,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.1.7",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg(ma_container_cpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}) OR on() vector(0)",
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg(ma_container_memory_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}) OR on() vector(0)",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "B"
        }
      ],
      "timeFrom": "15m",
      "title": "CPU&内存使用情况",
      "transformations": [
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/.*(cpu_util)[{].*/",
            "renamePattern": "$1"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/.*(memory_util)[{].*/",
            "renamePattern": "$1"
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${data_source}"
      },
      "description": "用户在当前池最近24小时的任务概要",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "displayMode": "auto",
            "filterable": true,
            "inspect": false
          },
          "decimals": 0,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*数$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "none"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*利用率$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 100
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "red",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 10
                    },
                    {
                      "color": "green",
                      "value": 85
                    }
                  ]
                }
              },
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*Read|Write平均速率$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "KBs"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*Receive|Send平均速率$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "Bps"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "开始时间"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsLocal"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "运行时长"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "任务ID"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "title": "",
                    "url": "/d/-b1bPyL4k/modelarts-task-view?orgId=1&${data_source:queryparam}&var-service_id=${__data.fields.任务ID}&from=${__data.fields[\"Value #A (min)\"]}&to=${__data.fields[\"Value #B (max)\"]}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Value #A (min)"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Value #B (max)"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "id": 19,
      "interval": "30m",
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.1.7",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "min by(service_id) (timestamp(min_over_time(ma_container_cpu_util{pool_id=\"$pool_id\",user_id=\"$user_id\"}[$__interval])) * 1000)",
          "format": "table",
          "hide": false,
          "interval": "1m",
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "max by(service_id) (timestamp(max_over_time(ma_container_cpu_util{pool_id=\"$pool_id\",user_id=\"$user_id\"}[$__interval])) * 1000)",
          "format": "table",
          "hide": false,
          "interval": "1m",
          "legendFormat": "__auto",
          "range": true,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id, modelarts_service) (avg_over_time(ma_container_cpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_memory_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "D"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "count by(service_id) (avg_over_time(ma_container_gpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "E"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_gpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "F"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_gpu_mem_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "G"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "count by(service_id) (avg_over_time(ma_container_npu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "H"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_npu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "I"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_npu_memory_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "J"
        }
      ],
      "timeFrom": "24h",
      "title": "最近24小时任务概要",
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value #A": {
                "aggregations": [
                  "min"
                ],
                "operation": "aggregate"
              },
              "Value #B": {
                "aggregations": [
                  "max"
                ],
                "operation": "aggregate"
              },
              "Value #C": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #D": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #E": {
                "aggregations": [
                  "max"
                ],
                "operation": "aggregate"
              },
              "Value #F": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #G": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #H": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #I": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #J": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "modelarts_service": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "service_id": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "duration_time_ms",
            "mode": "reduceRow",
            "reduce": {
              "include": [
                "Value #A (min)",
                "Value #B (max)"
              ],
              "reducer": "range"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "start_date",
            "mode": "reduceRow",
            "reduce": {
              "include": [
                "Value #A (min)"
              ],
              "reducer": "min"
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Value #A (min)": false,
              "Value #B (max)": false,
              "start_date": false
            },
            "indexByName": {
              "Value #A (min)": 4,
              "Value #B (max)": 5,
              "Value #C (lastNotNull)": 6,
              "Value #D (lastNotNull)": 7,
              "Value #H (lastNotNull)": 8,
              "Value #I (lastNotNull)": 9,
              "Value #J (lastNotNull)": 10,
              "duration_time_ms": 3,
              "modelarts_service (lastNotNull)": 1,
              "service_id": 0,
              "start_date": 2
            },
            "renameByName": {
              "Value #C (lastNotNull)": "CPU平均利用率",
              "Value #D (lastNotNull)": "内存平均利用率",
              "Value #E (max)": "GPU占用卡数",
              "Value #F (lastNotNull)": "GPU平均利用率",
              "Value #G (lastNotNull)": "显存平均利用率",
              "Value #H (lastNotNull)": "NPU占用卡数",
              "Value #I (lastNotNull)": "NPU平均利用率",
              "Value #J (lastNotNull)": "NPU内存平均利用率",
              "duration_time_ms": "运行时长",
              "duration_time_sec": "运行时长",
              "modelarts_service (lastNotNull)": "类型",
              "service_id": "任务ID",
              "start_date": "开始时间",
              "start_date_ms": "开始时间"
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "开始时间"
              }
            ]
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${data_source}"
      },
      "description": "用户在当前池最近7天的任务概要",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "displayMode": "auto",
            "filterable": true,
            "inspect": false
          },
          "decimals": 0,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*数$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "none"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*利用率$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 100
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "red",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 10
                    },
                    {
                      "color": "green",
                      "value": 85
                    }
                  ]
                }
              },
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*Read|Write平均速率$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "KBs"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*Receive|Send平均速率$/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "Bps"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "开始时间"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsLocal"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "运行时长"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "任务ID"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "title": "",
                    "url": "/d/-b1bPyL4k/modelarts-task-view?orgId=1&${data_source:queryparam}&var-service_id=${__data.fields.任务ID}&from=${__data.fields[\"Value #A (min)\"]}&to=${__data.fields[\"Value #B (max)\"]}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Value #A (min)"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Value #B (max)"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 13
      },
      "id": 20,
      "interval": "30m",
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.1.7",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "min by(service_id) (timestamp(min_over_time(ma_container_cpu_util{pool_id=\"$pool_id\",user_id=\"$user_id\"}[$__interval])) * 1000)",
          "format": "table",
          "hide": false,
          "interval": "1m",
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "max by(service_id) (timestamp(max_over_time(ma_container_cpu_util{pool_id=\"$pool_id\",user_id=\"$user_id\"}[$__interval])) * 1000)",
          "format": "table",
          "hide": false,
          "interval": "1m",
          "legendFormat": "__auto",
          "range": true,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id, modelarts_service) (avg_over_time(ma_container_cpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_memory_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "D"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "count by(service_id) (avg_over_time(ma_container_gpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "E"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_gpu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "F"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_gpu_mem_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "G"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "count by(service_id) (avg_over_time(ma_container_npu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "H"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_npu_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "I"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${data_source}"
          },
          "editorMode": "code",
          "expr": "avg by(service_id) (avg_over_time(ma_container_npu_memory_util{pool_id=\"$pool_id\", user_id=\"$user_id\"}[$__interval]))",
          "format": "table",
          "hide": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "J"
        }
      ],
      "timeFrom": "7d",
      "title": "最近7天任务概要",
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value #A": {
                "aggregations": [
                  "min"
                ],
                "operation": "aggregate"
              },
              "Value #B": {
                "aggregations": [
                  "max"
                ],
                "operation": "aggregate"
              },
              "Value #C": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #D": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #E": {
                "aggregations": [
                  "max"
                ],
                "operation": "aggregate"
              },
              "Value #F": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #G": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #H": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #I": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #J": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "modelarts_service": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "service_id": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "duration_time_ms",
            "mode": "reduceRow",
            "reduce": {
              "include": [
                "Value #A (min)",
                "Value #B (max)"
              ],
              "reducer": "range"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "start_date",
            "mode": "reduceRow",
            "reduce": {
              "include": [
                "Value #A (min)"
              ],
              "reducer": "min"
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Value #A (min)": false,
              "Value #B (max)": false,
              "start_date": false
            },
            "indexByName": {
              "Value #A (min)": 4,
              "Value #B (max)": 5,
              "Value #C (lastNotNull)": 6,
              "Value #D (lastNotNull)": 7,
              "Value #H (lastNotNull)": 8,
              "Value #I (lastNotNull)": 9,
              "Value #J (lastNotNull)": 10,
              "duration_time_ms": 3,
              "modelarts_service (lastNotNull)": 1,
              "service_id": 0,
              "start_date": 2
            },
            "renameByName": {
              "Value #C (lastNotNull)": "CPU平均利用率",
              "Value #D (lastNotNull)": "内存平均利用率",
              "Value #E (max)": "GPU占用卡数",
              "Value #F (lastNotNull)": "GPU平均利用率",
              "Value #G (lastNotNull)": "显存平均利用率",
              "Value #H (lastNotNull)": "NPU占用卡数",
              "Value #I (lastNotNull)": "NPU平均利用率",
              "Value #J (lastNotNull)": "NPU内存平均利用率",
              "duration_time_ms": "运行时长",
              "duration_time_sec": "运行时长",
              "modelarts_service (lastNotNull)": "类型",
              "service_id": "任务ID",
              "start_date": "开始时间",
              "start_date_ms": "开始时间"
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "开始时间"
              }
            ]
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": "15m",
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "cneast3-hryt",
          "value": "cneast3-hryt"
        },
        "hide": 0,
        "includeAll": false,
        "label": "data_source",
        "multi": false,
        "name": "data_source",
        "options": [],
        "query": "prometheus",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {
          "selected": false,
          "text": "pool-adas-66f4a8a92fd4465bb11cf3a8ad0a0c40",
          "value": "pool-adas-66f4a8a92fd4465bb11cf3a8ad0a0c40"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "${data_source}"
        },
        "definition": "ma_node_cpu_limit_core",
        "hide": 0,
        "includeAll": false,
        "label": "pool_id",
        "multi": false,
        "name": "pool_id",
        "options": [],
        "query": {
          "query": "ma_node_cpu_limit_core",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "/.*pool_id=\"([^\"]*).*/",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "04193bf1b0614544a73c446ad316310c",
          "value": "04193bf1b0614544a73c446ad316310c"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "${data_source}"
        },
        "definition": "ma_container_cpu_limit_core{pool_id=\"$pool_id\"}",
        "hide": 0,
        "includeAll": false,
        "label": "user_id",
        "multi": false,
        "name": "user_id",
        "options": [],
        "query": {
          "query": "ma_container_cpu_limit_core{pool_id=\"$pool_id\"}",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "/.*user_id=\"([^\"]*).*/",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "ModelArts-User-View",
  "uid": "8QcY6pLVk",
  "version": 232,
  "weekStart": "",
  "gnetId": 18588
}