grafana / grafonnet

Jsonnet library for generating Grafana dashboards.
https://grafana.github.io/grafonnet/
Apache License 2.0
352 stars 19 forks source link

RED example isn't building #186

Closed andrewdinunzio closed 6 months ago

andrewdinunzio commented 6 months ago

I had to make the following change to the red dashboard to get it to build with jsonnet:

diff --git a/examples/redMethod/lib/redDashboard/main.libsonnet b/examples/redMethod/lib/redDashboard/main.libsonnet
index 965c8bd..4024cea 100644
--- a/examples/redMethod/lib/redDashboard/main.libsonnet
+++ b/examples/redMethod/lib/redDashboard/main.libsonnet
@@ -1,4 +1,4 @@
-local g = import 'g.libsonnet';
+local g = import '../g.libsonnet';

 local panels = import './panels.libsonnet';

diff --git a/examples/redMethod/lib/redDashboard/panels.libsonnet b/examples/redMethod/lib/redDashboard/panels.libsonnet
index 7445e2f..1cd15b4 100644
--- a/examples/redMethod/lib/redDashboard/panels.libsonnet
+++ b/examples/redMethod/lib/redDashboard/panels.libsonnet
@@ -1,4 +1,4 @@
-local g = import 'g.libsonnet';
+local g = import '../g.libsonnet';

 {
   new(applicationName, requestTargets, latencyTargets):
diff --git a/examples/redMethod/lib/redDashboard/queries/prometheus.libsonnet b/examples/redMethod/lib/redDashboard/queries/prometheus.libsonnet
index e300e6b..be063ad 100644
--- a/examples/redMethod/lib/redDashboard/queries/prometheus.libsonnet
+++ b/examples/redMethod/lib/redDashboard/queries/prometheus.libsonnet
@@ -1,4 +1,4 @@
-local g = import 'g.libsonnet';
+local g = import '../../g.libsonnet';

 {
   new(
Duologic commented 6 months ago

Which command did you use to execute?

Duologic commented 6 months ago

To test with these dashboards, we set the Jsonnet path to include vendor/ and lib/, this might work for you too:

https://github.com/grafana/grafonnet/blob/b64295db53d183cb85ed47874cf607f93b80f539/Makefile#L48

andrewdinunzio commented 6 months ago

Ah yep I only added vendor to the jsonnet path. Thanks