Skip to content
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

Update datasource.go #19

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions etc/provisioning/dashboards/Default/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,83 @@
],
"title": "Timeseries Rate Metrics",
"type": "timeseries"
},
{
"datasource": {
"type": "fiskaly-surrealdb-datasource",
"uid": "fiskaly-surrealdb-datasource"
},
"description": "use LET statement of surreal to search into body ",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 28
},
"id": 6,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "11.1.3",
"targets": [
{
"datasource": {
"type": "fiskaly-surrealdb-datasource",
"uid": "fiskaly-surrealdb-datasource"
},
"group": false,
"mode": "raw",
"rate": false,
"rateFunctions": [
"count"
],
"rateInterval": "",
"rateZero": true,
"refId": "A",
"requery": true,
"surql": "let $body=\"it\";\nselect * from timeseries where body ~ $body;"
}
],
"title": "search in body",
"type": "table"
}
],
"refresh": "",
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func (r *Datasource) query(query string) (queryResponseData, error) {

// log.DefaultLogger.Info(fmt.Sprintf("arrResp: %s", arrResp))

dataMap, ok := array[0].(map[string]interface{})
dataMap, ok := array[len(array)-1].(map[string]interface{})
if ok == false || isArray == false {
return undefined, fmt.Errorf("invalid queryResponse array type")
}
Expand Down