grafana/grizzly

[Bug]: grr diff error with library panels

zzv2 opened this issue · 2 comments

zzv2 commented

Grizzly Version

main-4cf8f3d

Expected Behavior

grr diff ... should handle library panels that exists on the grizzly server but not grafana and not throw an exception

Actual Behavior

/bin/sh -c 'grr diff /grizzly/resources/'
Providers: Grafana - active, Mimir - inactive (mimir address is not set), Synthetic Monitoring - inactive (neither access token nor stack configuration (stack id, metrics id, logs id, token) are set. One must be set)
time="2024-09-17T23:42:49Z" level=info msg="Diff-ing 17 resources"
DashboardFolder.development no differences
DashboardFolder.production no differences
panic: interface conversion: interface {} is int, not float64

goroutine 1 [running]:
github.com/grafana/grizzly/pkg/grafana.(*LibraryElementHandler).ResourceFilePath(0xe?, {0xc0005a0f60, {{0x1326c3d, 0x4}, {0x0, 0x0}, {0xc0000b51c0, 0x3d}, 0x1}}, {0x1326c3d, ...})
	/home/runner/work/grizzly/grizzly/pkg/grafana/library-element-handler.go:39 +0x354
github.com/grafana/grizzly/pkg/grizzly.getFilename({{0xc0003c9b60, 0x3, 0x3}, 0xc0003c9b90, {0xc0000d5200, 0x9, 0x10}}, {0x0, 0x0}, 0xc0004df8e8, ...)
	/home/runner/work/grizzly/grizzly/pkg/grizzly/formatting.go:57 +0x159
github.com/grafana/grizzly/pkg/grizzly.Format({{0xc0003c9b60, 0x3, 0x3}, 0xc0003c9b90, {0xc0000d5200, 0x9, 0x10}}, {0x0, 0x0}, 0xc0004df8e8, ...)
	/home/runner/work/grizzly/grizzly/pkg/grizzly/formatting.go:44 +0x1d7
github.com/grafana/grizzly/pkg/grizzly.Diff({{0xc0003c9b60, 0x3, 0x3}, 0xc0003c9b90, {0xc0000d5200, 0x9, 0x10}}, {0x0?}, 0x0, {0x1326c3d, ...})
	/home/runner/work/grizzly/grizzly/pkg/grizzly/workflow.go:337 +0x2e5
main.diffCmd.func1(0xc0003c2e70?, {0xc0003eaa90, 0x1, 0x5cd320?})
	/home/runner/work/grizzly/grizzly/cmd/grr/workflow.go:205 +0x233
main.initialiseLogging.func1(0xc0003f92c0, {0xc0003eaa90, 0x1, 0x1})
	/home/runner/work/grizzly/grizzly/cmd/grr/workflow.go:547 +0x7f
github.com/go-clix/cli.(*Command).execute(0xc0003f92c0, {0xc0003eaa70, 0x1, 0x1})
	/home/runner/go/pkg/mod/github.com/go-clix/cli@v0.2.0/command.go:118 +0x444
github.com/go-clix/cli.(*Command).Execute(0xc000350fa0)
	/home/runner/go/pkg/mod/github.com/go-clix/cli@v0.2.0/command.go:76 +0xbb
main.main()
	/home/runner/work/grizzly/grizzly/cmd/grr/main.go:73 +0x5fe
make: *** [Makefile:61: grr-diff] Error 2
Error: Process completed with exit code 2.

Steps to Reproduce

  1. create a test dashboard and test library panel yaml file and load it on the grizzly server
  2. the grafana instance should not have the test dashboard and test library panel yet
  3. do grr diff ...
  4. see exception

Thanks for reporting this issue. #498 should fix it :)

zzv2 commented

@K-Phoen thanks for another quick fix!