Skip to content

Unmarshaling query imported from JSON #126

@mrosi

Description

@mrosi

To reproduce

Hi,
after import of dashboard from json /see additional contex bellow/ I received error message "error unmarshaling query JSON to the Query Model: json: cannot unmarshal string into Go struct field Query.format of type sqlutil.FormatQueryOption" ...

Image

Grafana log:

logger=plugin.questdb-questdb-datasource t=2026-02-17T08:54:45.350627516Z level=error msg="Partial data response error" uname="mrosi" dsName=questdb-questdb-datasource dsUid=bfdg9qayn8cg0a endpoint=queryData error="error unmarshaling query JSON to the Query Model: json: cannot unmarshal string into Go struct field Query.format of type sqlutil.FormatQueryOption" pluginId=questdb-questdb-datasource refID=A status=500 statusSource=downstream

As workaround works to cut query from SQL Editor switch to the builder select any table and field Run query, then go back to SQL Editor and paste the query ... now, it works

QuestDB version:

9.3.2

Grafana version:

12.3.2

Plugin version:

0.1.6

OS, in case of Docker specify Docker and the Host OS:

RHEL10 + podman

Full Name:

Martin Rosicky

Affiliation:

TechniArch

Have you followed Linux, MacOs kernel configuration steps to increase Maximum open files and Maximum virtual memory areas limit?

  • Yes, I have

Additional context

Dashboard definition:

{
    "uid": "5d1c706a-9f67-4eb3-abfe-e98baf283ad6",
    "orgId": 1,
    "title": "Operations Performance",
    "uri": "db/operations-performance",
    "url": "/d/5d1c706a-9f67-4eb3-abfe-e98baf283ad6/operations-performance",
    "slug": "",
    "type": "dash-db",
    "tags": [
        "draft"
    ],
    "isStarred": false,
    "folderUid": "66746896-d4f3-4037-a957-0ea294e80378",
    "folderTitle": "Operations",
    "folderUrl": "/dashboards/f/66746896-d4f3-4037-a957-0ea294e80378/gigamon",
    "sortMeta": 0,
    "isDeleted": false,
    "jsonData": {
        "meta": {
            "type": "db",
            "canSave": true,
            "canEdit": true,
            "canAdmin": true,
            "canStar": true,
            "canDelete": true,
            "slug": "operations-performance",
            "url": "/d/5d1c706a-9f67-4eb3-abfe-e98baf283ad6/operations-performance",
            "expires": "0001-01-01T00:00:00Z",
            "created": "2025-06-18T20:11:10Z",
            "updated": "2025-06-18T20:16:08Z",
            "updatedBy": "admin",
            "createdBy": "admin",
            "version": 2,
            "hasAcl": false,
            "isFolder": false,
            "apiVersion": "v0alpha1",
            "folderUid": "66746896-d4f3-4037-a957-0ea294e80378",
            "folderTitle": "Operations",
            "folderUrl": "/dashboards/f/66746896-d4f3-4037-a957-0ea294e80378/gigamon",
            "provisioned": false,
            "provisionedExternalId": "",
            "annotationsPermissions": {
                "dashboard": {
                    "canAdd": true,
                    "canEdit": true,
                    "canDelete": true
                },
                "organization": {
                    "canAdd": true,
                    "canEdit": true,
                    "canDelete": true
                }
            }
        },
        "dashboard": {
            "annotations": {
                "list": [
                    {
                        "builtIn": 1,
                        "datasource": {
                            "type": "grafana",
                            "uid": "-- Grafana --"
                        },
                        "enable": true,
                        "hide": true,
                        "iconColor": "rgba(0, 211, 255, 1)",
                        "name": "Annotations & Alerts",
                        "type": "dashboard"
                    }
                ]
            },
            "description": "Shows performance of GigaSMART operations",
            "editable": true,
            "fiscalYearStartMonth": 0,
            "folderUid": "66746896-d4f3-4037-a957-0ea294e80378",
            "graphTooltip": 0,
            "links": [],
            "liveNow": false,
            "panels": [
                {
                    "collapsed": false,
                    "gridPos": {
                        "h": 1,
                        "w": 24,
                        "x": 0,
                        "y": 0
                    },
                    "panels": [],
                    "title": "Overall",
                    "type": "row"
                },
                {
                    "datasource": {
                        "type": "questdb-questdb-datasource",
                        "uid": "${data_source}"
                    },
                    "description": "",
                    "fieldConfig": {
                        "defaults": {
                            "color": {
                                "mode": "palette-classic"
                            },
                            "custom": {
                                "axisBorderShow": false,
                                "axisCenteredZero": false,
                                "axisColorMode": "text",
                                "axisLabel": "",
                                "axisPlacement": "auto",
                                "barAlignment": 0,
                                "drawStyle": "line",
                                "fillOpacity": 0,
                                "gradientMode": "none",
                                "hideFrom": {
                                    "legend": false,
                                    "tooltip": false,
                                    "viz": false
                                },
                                "insertNulls": false,
                                "lineInterpolation": "smooth",
                                "lineWidth": 1,
                                "pointSize": 5,
                                "scaleDistribution": {
                                    "type": "linear"
                                },
                                "showPoints": "never",
                                "spanNulls": false,
                                "stacking": {
                                    "group": "A",
                                    "mode": "none"
                                },
                                "thresholdsStyle": {
                                    "mode": "off"
                                }
                            },
                            "displayName": "${__field.labels.cluster}:${__field.labels.map}",
                            "links": [
                                {
                                    "targetBlank": true,
                                    "title": "Map Rules",
                                    "url": "/d/a2b4b691-254b-4ecf-a890-e8cf8806484d/map-rules?orgId=1&refresh=15m&var-cluster=${__field.labels.cluster}\ufeff&var-maps=\ufeff${__field.labels.map}\ufeff&var-units=All&${__url_time_range}"
                                }
                            ],
                            "mappings": [],
                            "min": 0,
                            "thresholds": {
                                "mode": "absolute",
                                "steps": [
                                    {
                                        "color": "green",
                                        "value": null
                                    },
                                    {
                                        "color": "red",
                                        "value": 80
                                    },
                                    {
                                        "color": "#EAB839",
                                        "value": 90
                                    },
                                    {
                                        "color": "#6ED0E0",
                                        "value": 100
                                    }
                                ]
                            },
                            "unit": "si:"
                        },
                        "overrides": []
                    },
                    "gridPos": {
                        "h": 17,
                        "w": 24,
                        "x": 0,
                        "y": 1
                    },
                    "interval": "15m",
                    "options": {
                        "legend": {
                            "calcs": [],
                            "displayMode": "table",
                            "placement": "right",
                            "showLegend": true
                        },
                        "tooltip": {
                            "mode": "single",
                            "sort": "none"
                        }
                    },
                    "repeat": "units",
                    "repeatDirection": "v",
                    "targets": [
                        {
                            "datasource": {
                                "type": "questdb-questdb-datasource",
                                "uid": "${data_source}"
                            },
                            "format": 0,
                            "meta": {
                                "builderOptions": {
                                    "fields": [],
                                    "limit": "100",
                                    "mode": "list",
                                    "timeField": ""
                                }
                            },
                            "queryType": "sql",
                            "rawSql": " with series as (\r\n  select \r\n    timestamp time, cluster, alias,\r\n    rx_bits/(interval/1000000) rx_bps, rx_packets/(interval/1000000) rx_pps,\r\n    tx_bits/(interval/1000000) tx_bps, tx_packets/(interval/1000000) tx_pps\r\n  from (\r\n  select\r\n    timestamp, cluster, alias, timestamp - timestamp1 interval,\r\n    (rx_octets-rx_octets1)*8 rx_bits, rx_packets-rx_packets1 rx_packets,\r\n    (tx_octets-tx_octets1)*8 tx_bits, tx_packets-tx_packets1 tx_packets\r\n  from (\r\n  (select timestamp, cluster, alias, rx_octets, rx_packets, tx_octets, tx_packets\r\n  from gmon_gsops\r\n  where $__conditionalAll(cluster in ($cluster),$cluster) and $__timeFilter(timestamp)\r\n     and (alias ilike '%${search}%')\r\n  ) lt join gmon_gsops on (cluster,alias)\r\n  )\r\n  )),\r\n topn as (\r\n   select * from series\r\n  latest on time partition by cluster, alias\r\n  order by rx_${units:raw} desc limit $topn\r\n )\r\n select series.time,\r\n   --series.cluster, series.alias as operation,\r\n   concat(series.cluster,':',series.alias) \"Name\",\r\n  series.rx_${units:raw}, series.tx_${units:raw}\r\n from topn\r\n inner join series on (cluster,alias)\r\n order by series.time\r\n;\r\n",
                            "refId": "A",
                            "selectedFormat": 0
                        }
                    ],
                    "title": "Top GSOPs [$units]",
                    "type": "timeseries"
                },
                {
                    "collapsed": false,
                    "gridPos": {
                        "h": 1,
                        "w": 24,
                        "x": 0,
                        "y": 35
                    },
                    "panels": [],
                    "repeat": "cluster",
                    "repeatDirection": "h",
                    "title": "$cluster",
                    "type": "row"
                },
                {
                    "datasource": {
                        "type": "questdb-questdb-datasource",
                        "uid": "${data_source}"
                    },
                    "description": "",
                    "fieldConfig": {
                        "defaults": {
                            "color": {
                                "mode": "palette-classic"
                            },
                            "custom": {
                                "axisBorderShow": false,
                                "axisCenteredZero": false,
                                "axisColorMode": "text",
                                "axisLabel": "",
                                "axisPlacement": "auto",
                                "barAlignment": 0,
                                "drawStyle": "line",
                                "fillOpacity": 0,
                                "gradientMode": "none",
                                "hideFrom": {
                                    "legend": false,
                                    "tooltip": false,
                                    "viz": false
                                },
                                "insertNulls": false,
                                "lineInterpolation": "smooth",
                                "lineWidth": 1,
                                "pointSize": 5,
                                "scaleDistribution": {
                                    "type": "linear"
                                },
                                "showPoints": "never",
                                "spanNulls": false,
                                "stacking": {
                                    "group": "A",
                                    "mode": "none"
                                },
                                "thresholdsStyle": {
                                    "mode": "off"
                                }
                            },
                            "links": [
                                {
                                    "targetBlank": true,
                                    "title": "Map Details",
                                    "url": "http://localhost:3000/d/a2b4b691-254b-4ecf-a890-e8cf8806484d/map-rules?orgId=1&refresh=15m&${__url_time_range}&var-maps=${__field.labels.alias}&${cluster:queryparam}"
                                }
                            ],
                            "mappings": [],
                            "min": 0,
                            "thresholds": {
                                "mode": "absolute",
                                "steps": [
                                    {
                                        "color": "green"
                                    },
                                    {
                                        "color": "red",
                                        "value": 80
                                    },
                                    {
                                        "color": "#EAB839",
                                        "value": 90
                                    },
                                    {
                                        "color": "#6ED0E0",
                                        "value": 100
                                    }
                                ]
                            },
                            "unit": "si:"
                        },
                        "overrides": []
                    },
                    "gridPos": {
                        "h": 16,
                        "w": 24,
                        "x": 0,
                        "y": 36
                    },
                    "interval": "15m",
                    "options": {
                        "legend": {
                            "calcs": [],
                            "displayMode": "list",
                            "placement": "right",
                            "showLegend": true
                        },
                        "tooltip": {
                            "mode": "single",
                            "sort": "none"
                        }
                    },
                    "repeat": "units",
                    "repeatDirection": "v",
                    "targets": [
                        {
                            "datasource": {
                                "type": "questdb-questdb-datasource",
                                "uid": "${data_source}"
                            },
                            "editorMode": "code",
                            "format": "time_series",
                            "rawQuery": true,
                            "rawSql": " with series as (\r\n  select timestamp time, cluster, alias, bits/(interval/1000000) bps, packets/(interval/1000000) pps from (\r\n  select timestamp, cluster, alias, timestamp - timestamp1 interval, (octets-octets1)*8 bits, packets-packets1 packets from (\r\n  (select timestamp, cluster, alias, octets, packets\r\n  from gmon_maps\r\n  where $__conditionalAll(cluster in ($cluster),$cluster) and $__timeFilter(timestamp)\r\n     and (alias ilike '%${search}%' or comment ilike '%${search}%' or srcPortList ilike '%${search}%' or dstPortList ilike '%${search}%')\r\n     --and $__conditionalAll(srcportlist in ($mapsources),$mapsources) and $__conditionalAll(dstportlist in ($maptargets),$maptargets)\r\n  )lt join gmon_maps on (cluster,alias)\r\n  )\r\n  )),\r\n topn as (\r\n   select * from series\r\n  latest on time partition by cluster, alias\r\n  order by ${units:raw} desc limit $topn\r\n )\r\n select series.time,series.alias,series.${units:raw} from topn\r\n inner join series on (cluster,alias)\r\n order by series.time\r\n;\r\n",
                            "refId": "A",
                            "sql": {
                                "columns": [
                                    {
                                        "parameters": [],
                                        "type": "function"
                                    }
                                ],
                                "groupBy": [
                                    {
                                        "property": {
                                            "type": "string"
                                        },
                                        "type": "groupBy"
                                    }
                                ],
                                "limit": 50
                            }
                        }
                    ],
                    "title": "Top maps [$units]",
                    "transformations": [
                        {
                            "options": {
                                "format": "multi"
                            }
                        }
                    ],
                    "type": "timeseries"
                }
            ],
            "refresh": "15m",
            "schemaVersion": 39,
            "tags": [
                "draft"
            ],
            "templating": {
                "list": [
                    {
                        "allValue": "All",
                        "current": {
                            "selected": true,
                            "text": [
                                "o3gigc10",
                                "o4gigc10",
                                "o5gigc10"
                            ],
                            "value": [
                                "o3gigc10",
                                "o4gigc10",
                                "o5gigc10"
                            ]
                        },
                        "datasource": {
                            "type": "questdb-questdb-datasource",
                            "uid": "${data_source}"
                        },
                        "definition": "select distinct alias from gmon_clusters",
                        "description": "Select Cluster",
                        "hide": 0,
                        "includeAll": true,
                        "label": "Cluster:",
                        "multi": true,
                        "name": "cluster",
                        "options": [],
                        "query": "select distinct alias from gmon_clusters",
                        "refresh": 1,
                        "regex": "",
                        "skipUrlSync": false,
                        "sort": 1,
                        "type": "query"
                    },
                    {
                        "current": {
                            "selected": true,
                            "text": [
                                "All"
                            ],
                            "value": [
                                "$__all"
                            ]
                        },
                        "hide": 0,
                        "includeAll": true,
                        "label": "Units",
                        "multi": true,
                        "name": "units",
                        "options": [
                            {
                                "selected": true,
                                "text": "All",
                                "value": "$__all"
                            },
                            {
                                "selected": false,
                                "text": "bps",
                                "value": "bps"
                            },
                            {
                                "selected": false,
                                "text": "pps",
                                "value": "pps"
                            }
                        ],
                        "query": "bps,pps",
                        "queryValue": "",
                        "skipUrlSync": false,
                        "type": "custom"
                    },
                    {
                        "current": {
                            "selected": false,
                            "text": "20",
                            "value": "20"
                        },
                        "hide": 0,
                        "includeAll": false,
                        "label": "Top:",
                        "multi": false,
                        "name": "topn",
                        "options": [
                            {
                                "selected": false,
                                "text": "5",
                                "value": "5"
                            },
                            {
                                "selected": false,
                                "text": "10",
                                "value": "10"
                            },
                            {
                                "selected": false,
                                "text": "15",
                                "value": "15"
                            },
                            {
                                "selected": true,
                                "text": "20",
                                "value": "20"
                            },
                            {
                                "selected": false,
                                "text": "25",
                                "value": "25"
                            }
                        ],
                        "query": "5,10,15,20,25",
                        "queryValue": "",
                        "skipUrlSync": false,
                        "type": "custom"
                    },
                    {
                        "current": {
                            "selected": false,
                            "text": "",
                            "value": ""
                        },
                        "description": "Text search is done over map name, comment and source/destination ports",
                        "hide": 0,
                        "label": "Search:",
                        "name": "search",
                        "options": [
                            {
                                "selected": true,
                                "text": "",
                                "value": ""
                            }
                        ],
                        "query": "",
                        "skipUrlSync": false,
                        "type": "textbox"
                    },
                    {
                        "allowCustomValue": false,
                        "current": {},
                        "hide": 2,
                        "name": "data_source",
                        "options": [],
                        "query": "questdb-questdb-datasource",
                        "refresh": 1,
                        "regex": "",
                        "type": "datasource"
                    }
                ]
            },
            "time": {
                "from": "now-24h",
                "to": "now"
            },
            "timepicker": {
                "refresh_intervals": [
                    "15m",
                    "30m",
                    "1h",
                    "2h",
                    "1d"
                ]
            },
            "timezone": "",
            "title": "Operations Performance",
            "uid": "5d1c706a-9f67-4eb3-abfe-e98baf283ad6",
            "version": 2,
            "weekStart": ""
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions