grafana-sync
grafana-sync copied to clipboard
cannot unmarshal number into Go struct field
Hello,
Thank you for Grafana-sync, but I faced this issue during sync my dashboards:
2021/03/05 11:46:32 unmarshal board: json: cannot unmarshal number into Go struct field Board.panels of type string for db/kubernetes-networking-namespace-pods
2021/03/05 11:46:32 unmarshal board: json: cannot unmarshal number into Go struct field Board.panels of type string for db/kubernetes-networking-pod
2021/03/05 11:46:34 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/loki-quick-search
2021/03/05 11:46:36 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/services-overview
Here is a gist with dashboards https://gist.github.com/ingvarch/51ef3022738d3b9011b2ce802a605aaf
I use :
Grafana v7.4.2 (29e75ad97b) Grafana-sync - 1.1.0
Hello, thank you for reporting an issue. I will check why some dashboards are not synced
I found that if I remove grafana variables namespace
and pod
in loki-quick-search dashboard - I can pull this dashboard.
I think that issue with fixed in the latest version of sdk. I Will try to update SDK and test
@ingvarch can you try this version 1.1.1?
Yes, I tried version 1.1.1 but the same problem
2021/03/05 13:27:41 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/kubernetes-compute-resources-workload
2021/03/05 13:27:42 unmarshal board: json: cannot unmarshal number into Go struct field Board.panels of type string for db/kubernetes-networking-namespace-pods
2021/03/05 13:27:42 unmarshal board: json: cannot unmarshal number into Go struct field Board.panels of type string for db/kubernetes-networking-pod
2021/03/05 13:27:43 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/loki-quick-search
I opened issue for grafana sdk. Will try to look at it by myself once I have free time
Hi @mpostument , i get the same Problem with one of my dashboards. How could this error be debuged? Is there a verbose oder debug function? I use :
Grafana v7.3.7 (1e261642f4)
Grafana-sync - 1.2.0
2021/03/08 14:15:49 unmarshal board: json: cannot unmarshal number into Go struct field Board.panels of type string for db/aufteilung-Dashboard
This this sdk issue. I will check if I can get additional information from sdk itself
Hello, @mpostument
Any updates ?
This PR was merged yesterday. Potentially it should resolve issue. Will update code late today
Try if this version works https://github.com/mpostument/grafana-sync/releases/tag/1.4.1
Sorry for my delay. It still doesn't work. Version 1.4.1
2021/08/11 08:36:27 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/kubernetes-networking-workload
2021/08/11 08:36:27 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/kubernetes-persistent-volumes
2021/08/11 08:36:27 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/kubernetes-pods
2021/08/11 08:36:27 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/kubernetes-statefulsets
2021/08/11 08:36:27 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/loki-quick-search
same/similar issue:
2022/06/13 16:15:19 unmarshal board: json: cannot unmarshal number into Go struct field FieldConfigCustom.fieldConfig.defaults.custom.spanNulls of type bool (panel "$deployment" of type "timeseries") for db/deployment-network-io
Please try this version https://github.com/mpostument/grafana-sync/releases/tag/1.4.8 It includes a new version of grafana SDK which may solve this issue
I tried the most recent 1.4.8 release and I am getting these errors:
2022/07/29 11:18:16 unmarshal board: json: cannot unmarshal object into Go struct field Target.targets.group of type []struct { Type string "json:\"type,omitempty\""; Params []string "json:\"params,omitempty\"" } (panel "Metric" of type "graph") for db/aws-cloudwatch-browser
2022/07/29 11:18:16 unmarshal board: json: cannot unmarshal object into Go struct field Target.targets.group of type []struct { Type string "json:\"type,omitempty\""; Params []string "json:\"params,omitempty\"" } (panel "CPUUtilization" of type "graph") for db/aws-ec2
2022/07/29 11:18:16 unmarshal board: json: cannot unmarshal object into Go struct field Target.targets.group of type []struct { Type string "json:\"type,omitempty\""; Params []string "json:\"params,omitempty\"" } (panel "RequestCount / Latency" of type "graph") for db/aws-elb-classic-load-balancer
2022/07/29 11:18:16 unmarshal board: json: cannot unmarshal object into Go struct field Target.targets.group of type []struct { Type string "json:\"type,omitempty\""; Params []string "json:\"params,omitempty\"" } (panel "Healthy / Unhealthy Hosts Count" of type "graph") for db/aws-network-load-balancer-nlb
2022/07/29 11:18:16 unmarshal board: json: cannot unmarshal object into Go struct field Target.targets.group of type []struct { Type string "json:\"type,omitempty\""; Params []string "json:\"params,omitempty\"" } (panel "CPUUtilization/FailedSQLServerAgentJobsCount" of type "graph") for db/aws-rds
The errors looks somewhat different so maybe progress?
Aug 26 09:22:46 bastion teleport[6630]: SQLite configuration is invalid: failed to unmarshal map[data_dir:/var/lib/teleport path:/var/lib/teleport/backend sync:false] into **lite.Config, json: cannot un>
Aug 26 09:22:46 bastion teleport[6630]: "\tjson: cannot unmarshal bool into Go struct field Config.sync of type string"
config item :
storage:
type: sqlite
sync: OFF
when adding quote to OFF it's working :
storage:
type: sqlite
sync: "OFF"
Running 1.4.10, experiencing the same issue.
I am having a similar problem with 1.7.0:
2024/02/14 11:51:44 unmarshal board: json: cannot unmarshal string into Go struct field Target.targets.groupBy of type []string (panel "Max Memory Usage (last 15m)" of type "bargauge") for db/gitlab-runners-metrics
Here is a JSON export of the dashboard in question: gitlab-runners-metrics.json
similar issue with grafana-sync 1.7.0 and grafana 10.2.3
2024/02/16 11:56:31 unmarshal board: json: cannot unmarshal object into Go struct field Target.targets.groupBy of type string (panel "CPU usage/s for $instance" of type "graph") (panel "Resources" of type "row") for db/alertmanager
2024/02/16 11:56:32 unmarshal board: json: cannot unmarshal object into Go struct field Target.targets.tags of type []struct { Key string "json:\"key,omitempty\""; Operator string "json:\"operator,omitempty\""; Value string "json:\"value,omitempty\"" } (panel "Global Samples Sent by Remote" of type "timeseries") for db/prometheus-remote-storage-stats
@mpostument is there a chance to take a look into my comment
https://github.com/mpostument/grafana-sync/issues/6#issuecomment-1948184832
Sorry, there is no fix yet. Looks like grafana sdk is no longer developed. I don't see any PR accepted in sdk repo. Don't have fix right now
@mpostument do you think that the grafana sdk is replaced with https://github.com/grafana/grafana-plugin-sdk-go or it's a different thing?