-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure Data Explorer plugin: 400 Bad Request on GUI-designed query due to missing escaping of "time" column #558
Comments
Thanks for creating this issue, @sandersaares generally it is better to use Grafana's built-in time-macros for filtering by time: have you tried these instead? |
As you can see on my screenshot, I am creating a query using the GUI designer. Presumably this already implies that the relevant macros are used. You can also see the macro in the query inspector output I pasted. |
could you please copy and paste all relevant data using the here are more details and steps for copying your data over to this issue: https://grafana.com/docs/grafana/latest/troubleshooting/send-panel-to-grafana-support/ |
Panel debug snapshot dashboard{
"panels": [
{
"id": 2,
"gridPos": {
"h": 13,
"w": 15,
"x": 0,
"y": 0
},
"type": "timeseries",
"title": "Reproduced with embedded data",
"targets": [
{
"refId": "A",
"datasource": {
"type": "grafana",
"uid": "grafana"
},
"queryType": "snapshot",
"snapshot": [
{
"schema": {
"refId": "A",
"meta": {
"executedQueryString": "grafana63304\n| where time >= datetime(2023-02-15T01:52:33.943Z) and time <= datetime(2023-02-15T07:52:33.943Z)\n| order by time asc"
},
"fields": []
},
"data": {
"values": []
}
}
]
}
],
"options": {
"tooltip": {
"mode": "single",
"sort": "none"
},
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom",
"calcs": []
}
},
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineInterpolation": "linear",
"barAlignment": 0,
"lineWidth": 1,
"fillOpacity": 0,
"gradientMode": "none",
"spanNulls": false,
"showPoints": "auto",
"pointSize": 5,
"stacking": {
"mode": "none",
"group": "A"
},
"axisPlacement": "auto",
"axisLabel": "",
"axisColorMode": "text",
"scaleDistribution": {
"type": "linear"
},
"axisCenteredZero": false,
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"thresholdsStyle": {
"mode": "off"
}
},
"color": {
"mode": "palette-classic"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": null,
"color": "green"
},
{
"value": 80,
"color": "red"
}
]
}
},
"overrides": []
},
"datasource": {
"type": "grafana",
"uid": "grafana"
}
},
{
"gridPos": {
"h": 7,
"w": 9,
"x": 15,
"y": 0
},
"id": 5,
"options": {
"content": "<table width=\"100%\">\n <tr>\n <th width=\"2%\">Panel</th>\n <td >timeseries @ 9.3.2.2 (67a213dc85)</td>\n </tr>\n <tr>\n <th>Queries</th>\n <td>A[grafana-azure-data-explorer-datasource]</td>\n </tr>\n \n <tr><th>Data</th><td>Error 1 frames, 0 fields, 0 rows </td></tr>\n \n <tr>\n <th>Grafana</th>\n <td>9.3.2.2 (67a213dc85) // Pro</td>\n </tr>\n </table>",
"mode": "html"
},
"title": "Debug info",
"type": "text"
},
{
"id": 6,
"title": "Original Panel JSON",
"type": "text",
"gridPos": {
"h": 13,
"w": 9,
"x": 15,
"y": 7
},
"options": {
"content": "{\n \"id\": 2,\n \"gridPos\": {\n \"x\": 0,\n \"y\": 0,\n \"w\": 12,\n \"h\": 9\n },\n \"type\": \"timeseries\",\n \"title\": \"Panel Title\",\n \"targets\": [\n {\n \"query\": \"grafana63304\\n| where $__timeFilter(time)\\n| order by time asc\",\n \"querySource\": \"raw\",\n \"expression\": {\n \"where\": {\n \"type\": \"and\",\n \"expressions\": []\n },\n \"groupBy\": {\n \"type\": \"and\",\n \"expressions\": []\n },\n \"reduce\": {\n \"type\": \"and\",\n \"expressions\": []\n },\n \"from\": {\n \"type\": \"property\",\n \"property\": {\n \"type\": \"string\",\n \"name\": \"grafana63304\"\n }\n }\n },\n \"pluginVersion\": \"4.2.0\",\n \"datasource\": {\n \"type\": \"grafana-azure-data-explorer-datasource\",\n \"uid\": \"u4kH7I14k\"\n },\n \"refId\": \"A\",\n \"rawMode\": false,\n \"resultFormat\": \"table\",\n \"database\": \"feb23\"\n }\n ],\n \"options\": {\n \"tooltip\": {\n \"mode\": \"single\",\n \"sort\": \"none\"\n },\n \"legend\": {\n \"showLegend\": true,\n \"displayMode\": \"list\",\n \"placement\": \"bottom\",\n \"calcs\": []\n }\n },\n \"fieldConfig\": {\n \"defaults\": {\n \"custom\": {\n \"drawStyle\": \"line\",\n \"lineInterpolation\": \"linear\",\n \"barAlignment\": 0,\n \"lineWidth\": 1,\n \"fillOpacity\": 0,\n \"gradientMode\": \"none\",\n \"spanNulls\": false,\n \"showPoints\": \"auto\",\n \"pointSize\": 5,\n \"stacking\": {\n \"mode\": \"none\",\n \"group\": \"A\"\n },\n \"axisPlacement\": \"auto\",\n \"axisLabel\": \"\",\n \"axisColorMode\": \"text\",\n \"scaleDistribution\": {\n \"type\": \"linear\"\n },\n \"axisCenteredZero\": false,\n \"hideFrom\": {\n \"tooltip\": false,\n \"viz\": false,\n \"legend\": false\n },\n \"thresholdsStyle\": {\n \"mode\": \"off\"\n }\n },\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"value\": null,\n \"color\": \"green\"\n },\n {\n \"value\": 80,\n \"color\": \"red\"\n }\n ]\n }\n },\n \"overrides\": []\n },\n \"datasource\": {\n \"uid\": \"u4kH7I14k\",\n \"type\": \"grafana-azure-data-explorer-datasource\"\n }\n}",
"mode": "code",
"code": {
"language": "json",
"showLineNumbers": true,
"showMiniMap": true
}
}
},
{
"id": 3,
"title": "Data from panel above",
"type": "table",
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"gridPos": {
"h": 7,
"w": 15,
"x": 0,
"y": 13
},
"options": {
"showTypeIcons": true
},
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"withTransforms": true,
"refId": "A"
}
]
}
],
"schemaVersion": 37,
"title": "Debug: Panel Title // 2023-02-15 07:52:51",
"tags": [
"debug",
"debug-timeseries"
],
"time": {
"from": "2023-02-15T01:52:51.634Z",
"to": "2023-02-15T07:52:51.634Z"
}
} |
Hi @sandersaares - I can replicate this issue as mentioned. We are looking into how to handle reserved keywords in the query builder. In the meantime there are two workarounds you can use to run a successful query:
|
What happened:
I suspect this is be due to lack of required keyword-escaping of
time
.What you expected to happen:
A working query should have been created.
How to reproduce it (as minimally and precisely as possible):
Make Azure Data Explorer table with timestamp in
time
column.Sample data: metrics.json.gz
Anything else we need to know?:
Environment:
The text was updated successfully, but these errors were encountered: