Cloudwatch search use different MetricEditorMode(builder and code) the response are different

  • What Grafana version and what operating system are you using?
    grafana v8.3.3

  • What are you trying to achieve?
    I think I find a bug and need your help to fix it.

  • What happened?
    I just upgrade grafana from 7.* to 8.3.3 and find some of the dashboard cannot work.

  • What did you expect to happen?
    And I have some test of them, change metricEditorMode to be builder and it back to normal.

Then I compared the curl request for these two different module and find the only different is “metricEditorMode”

  • curl Request which have issues
  curl 'https://*****/grafana/api/ds/query' \
  -H 'Connection: keep-alive' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'content-type: application/json' \
  -H 'x-grafana-org-id: 1' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'Origin: https://******' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: https://*****/grafana/d/9lCshFJnk/new-dashboard?orgId=1&editPanel=2' \
  -H 'Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7' \
  -H 'Cookie: grafana_session=*******; redirect_to=%2F' \
  --data-raw $'{"from":"1642028506505","to":"1642050106505","queries":[{"intervalMs":60000,"maxDataPoints":416,"queryMode":"Metrics","namespace":"AWS/ES","metricName":"CPUUtilization","expression":"REMOVE_EMPTY(SEARCH(\'Namespace=\\"AWS/ES\\" MetricName=\\"CPUUtilization\\" \\"DomainName\\"=\\"async-search-devb\\" \\"NodeId\\"\', \'Maximum\', 60))","dimensions":{"DomainName":["******"],"NodeId":["*"]},"region":"us-east-1","id":"","alias":"","statistic":"Maximum","period":"","metricQueryType":0,"metricEditorMode":1,"sqlExpression":"","datasource":{"type":"cloudwatch","uid":"l2xNhr07k"},"matchExact":false,"refId":"A","type":"timeSeriesQuery"}]}' \
  --compressed
  • curl Request Normal
curl 'https://******/grafana/api/ds/query' \
  -H 'Connection: keep-alive' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'content-type: application/json' \
  -H 'x-grafana-org-id: 1' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'Origin: https://*******' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: https://********/grafana/d/9lCshFJnk/new-dashboard?orgId=1&editPanel=2' \
  -H 'Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7' \
  -H 'Cookie: grafana_session=*******; redirect_to=%2F' \
  --data-raw $'{"from":"1642028359921","to":"1642049959921","queries":[{"intervalMs":60000,"maxDataPoints":416,"queryMode":"Metrics","namespace":"AWS/ES","metricName":"CPUUtilization","expression":"REMOVE_EMPTY(SEARCH(\'Namespace=\\"AWS/ES\\" MetricName=\\"CPUUtilization\\" \\"DomainName\\"=\\"async-search-devb\\" \\"NodeId\\"\', \'Maximum\', 60))","dimensions":{"DomainName":["*****"],"NodeId":["*"]},"region":"us-east-1","id":"","alias":"","statistic":"Maximum","period":"","metricQueryType":0,"metricEditorMode":0,"sqlExpression":"","datasource":{"type":"cloudwatch","uid":"l2xNhr07k"},"matchExact":false,"refId":"A","type":"timeSeriesQuery"}]}' \
  --compressed