mpostument / grafana-sync

Keep your Grafana dashboards in sync
Apache License 2.0
216 stars 23 forks source link

cannot unmarshal number into Go struct field #6

Open ingvarch opened 3 years ago

ingvarch commented 3 years ago

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

mpostument commented 3 years ago

Hello, thank you for reporting an issue. I will check why some dashboards are not synced

ingvarch commented 3 years ago

I found that if I remove grafana variables namespace and pod in loki-quick-search dashboard - I can pull this dashboard.

Screenshot 2021-03-05 at 2 31 33 PM

mpostument commented 3 years ago

I think that issue with fixed in the latest version of sdk. I Will try to update SDK and test

mpostument commented 3 years ago

@ingvarch can you try this version 1.1.1?

ingvarch commented 3 years ago

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
mpostument commented 3 years ago

I opened issue for grafana sdk. Will try to look at it by myself once I have free time

SaschaBrechmannVHV commented 3 years ago

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

mpostument commented 3 years ago

This this sdk issue. I will check if I can get additional information from sdk itself

ingvarch commented 3 years ago

Hello, @mpostument

Any updates ?

mpostument commented 3 years ago

This PR was merged yesterday. Potentially it should resolve issue. Will update code late today

mpostument commented 3 years ago

Try if this version works https://github.com/mpostument/grafana-sync/releases/tag/1.4.1

ingvarch commented 3 years ago

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
adamjacobmuller commented 2 years ago

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
mpostument commented 2 years ago

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

sarasensible commented 2 years ago

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?

sbourdette commented 2 years ago
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"
aned commented 1 year ago

Running 1.4.10, experiencing the same issue.

smipi1 commented 8 months ago

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

BouchaaraAdil commented 8 months ago

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
BouchaaraAdil commented 7 months ago

@mpostument is there a chance to take a look into my comment

https://github.com/mpostument/grafana-sync/issues/6#issuecomment-1948184832

mpostument commented 7 months ago

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

BouchaaraAdil commented 6 months ago

@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?