You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cloud Monitoring Dashboard组件重新编辑时丢失legendTemplate配置

问题

我已成功为组件JSON添加静态图例模板,初始配置如下:

{
  "xyChart": {
    "dataSets": [
      {
        "timeSeriesQuery": {
          "prometheusQuery": "sum(increase({\"__name__\"=\"storage.googleapis.com/network/sent_bytes_count\",\"monitored_resource\"=\"gcs_bucket\"}[${__interval}])) by()"
        },
        "plotType": "STACKED_BAR",
        "targetAxis": "Y1",
        "legendTemplate": "Bytes sent"
      }
    ],
    "chartOptions": {
      "mode": "COLOR",
      "displayHorizontal": false
    },
    "thresholds": [],
    "yAxis": {
      "scale": "LINEAR"
    }
  }
}

该配置可正常生效,但重新编辑组件时,JSON中的legendTemplate设置丢失,编辑后的配置变为:

{
  "xyChart": {
    "dataSets": [
      {
        "timeSeriesQuery": {
          "prometheusQuery": "sum(increase({\"__name__\"=\"storage.googleapis.com/network/sent_bytes_count\",\"monitored_resource\"=\"gcs_bucket\"}[${__interval}])) by()"
        },
        "plotType": "STACKED_BAR",
        "targetAxis": "Y1"
      }
    ],
    "chartOptions": {
      "mode": "COLOR",
      "displayHorizontal": false
    },
    "thresholds": [],
    "yAxis": {
      "scale": "LINEAR"
    }
  }
}

推测原因是编辑器默认启动PromQL表单编辑器,该编辑器会删除无法识别处理的设置。期望编辑器能保留无法处理的设置,或者默认使用JSON编辑器进行编辑。


内容的提问来源于stack exchange,提问作者Rich Theobald

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 01:39:56