[Bug]: grr server with AlertRuleGroup does not work #572
Description
Grizzly Version
0.7.1 (latest)
Expected Behavior
I'm trying to use one of the latest feature : "Support previewing AlertRuleGroup resources in grr serve"
I'm launching grr server
and targeting the folder which has my latest grafana objects (json format). The alert rules are correctly displayed in the grizzly UI browser, but I'm getting an error when I click on anyone of them.
Actual Behavior
Here are the errors, happy to provide you with more info, if needed :
INFO Listening on http://localhost:8080/
2025/01/23 08:25:36 http: panic serving [::1]:49998: interface conversion: interface {} is float64, not int
goroutine 29 [running]:
net/http.(*conn).serve.func1()
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:1947 +0xbe
panic({0x11a1a40?, 0xc000420e10?})
/opt/hostedtoolcache/go/1.23.4/x64/src/runtime/panic.go:785 +0x132
github.com/grafana/grizzly/pkg/grafana.(*alertRuleProxyConfigurator).Endpoints.(*alertRuleProxyConfigurator).alertRuleJSONGetHandler.func2({0x7f7ba24958b8, 0xc0003fd580}, 0xc0004340f0?)
/home/runner/work/grizzly/grizzly/pkg/grafana/alertgroup-proxy.go:118 +0x2dd
net/http.HandlerFunc.ServeHTTP(0x117a240?, {0x7f7ba24958b8?, 0xc0003fd580?}, 0xc0003d41e4?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/go-chi/chi.(*Mux).routeHTTP(0xc000123380, {0x7f7ba24958b8, 0xc0003fd580}, 0xc000343a40)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/mux.go:436 +0x1f2
net/http.HandlerFunc.ServeHTTP(0x20e4bd0?, {0x7f7ba24958b8?, 0xc0003fd580?}, 0x7f7ba27e5ff8?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/grafana/grizzly/pkg/grizzly.(*Server).Start.RequestLogger.func1.1({0x159e490, 0xc0001c4d20}, 0xc000343900)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/middleware/logger.go:57 +0x154
net/http.HandlerFunc.ServeHTTP(0x15a15b8?, {0x159e490?, 0xc0001c4d20?}, 0x20ccd30?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc000123380, {0x159e490, 0xc0001c4d20}, 0xc0003437c0)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/mux.go:87 +0x2ef
net/http.serverHandler.ServeHTTP({0xc0004206c0?}, {0x159e490?, 0xc0001c4d20?}, 0x6?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:3210 +0x8e
net/http.(*conn).serve(0xc0004301b0, {0x15a1580, 0xc000524ed0})
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2092 +0x5d0
created by net/http.(*Server).Serve in goroutine 1
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:3360 +0x485
2025/01/23 08:25:36 http: panic serving [::1]:49984: interface conversion: interface {} is float64, not int
goroutine 12 [running]:
net/http.(*conn).serve.func1()
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:1947 +0xbe
panic({0x11a1a40?, 0xc000420f90?})
/opt/hostedtoolcache/go/1.23.4/x64/src/runtime/panic.go:785 +0x132
github.com/grafana/grizzly/pkg/grafana.(*alertRuleProxyConfigurator).Endpoints.(*alertRuleProxyConfigurator).alertRuleJSONGetHandler.func2({0x7f7ba24958b8, 0xc0003fd640}, 0xc00041ee10?)
/home/runner/work/grizzly/grizzly/pkg/grafana/alertgroup-proxy.go:118 +0x2dd
net/http.HandlerFunc.ServeHTTP(0x117a240?, {0x7f7ba24958b8?, 0xc0003fd640?}, 0xc0003d42a4?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/go-chi/chi.(*Mux).routeHTTP(0xc000123380, {0x7f7ba24958b8, 0xc0003fd640}, 0xc000343e00)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/mux.go:436 +0x1f2
net/http.HandlerFunc.ServeHTTP(0x20e4bd0?, {0x7f7ba24958b8?, 0xc0003fd640?}, 0x7f7ba27e5ff8?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/grafana/grizzly/pkg/grizzly.(*Server).Start.RequestLogger.func1.1({0x159e490, 0xc0001c4ee0}, 0xc000343cc0)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/middleware/logger.go:57 +0x154
net/http.HandlerFunc.ServeHTTP(0x15a15b8?, {0x159e490?, 0xc0001c4ee0?}, 0x20ccd30?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc000123380, {0x159e490, 0xc0001c4ee0}, 0xc000343b80)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/mux.go:87 +0x2ef
net/http.serverHandler.ServeHTTP({0xc0005251d0?}, {0x159e490?, 0xc0001c4ee0?}, 0x6?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:3210 +0x8e
net/http.(*conn).serve(0xc0001ff710, {0x15a1580, 0xc000524ed0})
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2092 +0x5d0
created by net/http.(*Server).Serve in goroutine 1
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:3360 +0x485
2025/01/23 08:25:36 http: panic serving [::1]:54404: interface conversion: interface {} is float64, not int
goroutine 42 [running]:
net/http.(*conn).serve.func1()
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:1947 +0xbe
panic({0x11a1a40?, 0xc00049c7b0?})
/opt/hostedtoolcache/go/1.23.4/x64/src/runtime/panic.go:785 +0x132
github.com/grafana/grizzly/pkg/grafana.(*alertRuleProxyConfigurator).Endpoints.(*alertRuleProxyConfigurator).alertRuleJSONGetHandler.func2({0x7f7ba24958b8, 0xc0000d1140}, 0xc00065f430?)
/home/runner/work/grizzly/grizzly/pkg/grafana/alertgroup-proxy.go:118 +0x2dd
net/http.HandlerFunc.ServeHTTP(0x117a240?, {0x7f7ba24958b8?, 0xc0000d1140?}, 0xc0001b8604?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/go-chi/chi.(*Mux).routeHTTP(0xc000123380, {0x7f7ba24958b8, 0xc0000d1140}, 0xc00020d900)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/mux.go:436 +0x1f2
net/http.HandlerFunc.ServeHTTP(0x20e4bd0?, {0x7f7ba24958b8?, 0xc0000d1140?}, 0x7f7ba27fa278?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/grafana/grizzly/pkg/grizzly.(*Server).Start.RequestLogger.func1.1({0x159e490, 0xc0005fe8c0}, 0xc00020d7c0)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/middleware/logger.go:57 +0x154
net/http.HandlerFunc.ServeHTTP(0x15a15b8?, {0x159e490?, 0xc0005fe8c0?}, 0x20ccd30?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2220 +0x29
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc000123380, {0x159e490, 0xc0005fe8c0}, 0xc00020d680)
/home/runner/go/pkg/mod/github.com/go-chi/chi@v1.5.5/mux.go:87 +0x2ef
net/http.serverHandler.ServeHTTP({0xc00049c600?}, {0x159e490?, 0xc0005fe8c0?}, 0x6?)
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:3210 +0x8e
net/http.(*conn).serve(0xc0003b2630, {0x15a1580, 0xc000524ed0})
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:2092 +0x5d0
created by net/http.(*Server).Serve in goroutine 1
/opt/hostedtoolcache/go/1.23.4/x64/src/net/http/server.go:3360 +0x485
^C
Steps to Reproduce
No response