Skip to content

Commit 1a0a815

Browse files
committed
Dashboards: Add Grafonnet examples
1 parent 1191196 commit 1a0a815

File tree

7 files changed

+91
-3
lines changed

7 files changed

+91
-3
lines changed

dashboard/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ program, including its feature for supporting "builders".
99

1010
- Dashboards in native Grafana JSON format, from https://play.grafana.org/.
1111

12-
- Dashboards using both [grafanalib] or [grafana-dashboard], for expressing
13-
Grafana Dashboards as code, in Python.
12+
- Dashboards using [Grafonnet], [grafanalib], or [grafana-dashboard], for expressing
13+
Grafana Dashboards as code, using [Jsonnet], and Python.
1414

1515
- To get inspired by reading more examples, please also visit
16-
[grafana-dashboard examples] and [grafanalib examples].
16+
[grafonnet examples], [grafana-dashboard examples], and [grafanalib examples].
1717

1818

1919
[grafana-dashboard]: https://github.com/fzyzcjy/grafana_dashboard_python
2020
[grafana-dashboard examples]: https://github.com/fzyzcjy/grafana_dashboard_python/tree/master/examples
2121
[grafanalib]: https://github.com/weaveworks/grafanalib
2222
[grafanalib examples]: https://github.com/weaveworks/grafanalib/tree/main/grafanalib/tests/examples
23+
[Grafonnet]: https://github.com/grafana/grafonnet
24+
[grafonnet examples]: https://github.com/grafana/grafonnet/tree/main/examples
25+
[Jsonnet]: https://github.com/google/go-jsonnet
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// dashboard.jsonnet
2+
local grafonnet = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
3+
4+
grafonnet.dashboard.new('My Dashboard')
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
local g = import 'g.libsonnet';
2+
3+
g.dashboard.new('Faro dashboard')
4+
+ g.dashboard.withUid('faro-grafonnet-demo')
5+
+ g.dashboard.withDescription('Dashboard for Faro')
6+
+ g.dashboard.graphTooltip.withSharedCrosshair()
7+
+ g.dashboard.withPanels([
8+
g.panel.timeSeries.new('Requests / sec')
9+
+ g.panel.timeSeries.queryOptions.withTargets([
10+
g.query.prometheus.new(
11+
'mimir',
12+
'sum by (status_code) (rate(request_duration_seconds_count{job=~".*/faro-api"}[$__rate_interval]))',
13+
),
14+
])
15+
+ g.panel.timeSeries.standardOptions.withUnit('reqps')
16+
+ g.panel.timeSeries.gridPos.withW(24)
17+
+ g.panel.timeSeries.gridPos.withH(8),
18+
])
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": 1,
3+
"dependencies": [
4+
{
5+
"source": {
6+
"git": {
7+
"remote": "https://github.com/grafana/grafonnet.git",
8+
"subdir": "gen/grafonnet-latest"
9+
}
10+
},
11+
"version": "main"
12+
}
13+
],
14+
"legacyImports": true
15+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"version": 1,
3+
"dependencies": [
4+
{
5+
"source": {
6+
"git": {
7+
"remote": "https://github.com/grafana/grafonnet.git",
8+
"subdir": "gen/grafonnet-latest"
9+
}
10+
},
11+
"version": "1c56af39815c4903e47c27194444456f005f65df",
12+
"sum": "GxEO83uxgsDclLp/fmlUJZDbSGpeUZY6Ap3G2cgdL1g="
13+
},
14+
{
15+
"source": {
16+
"git": {
17+
"remote": "https://github.com/grafana/grafonnet.git",
18+
"subdir": "gen/grafonnet-v10.4.0"
19+
}
20+
},
21+
"version": "1c56af39815c4903e47c27194444456f005f65df",
22+
"sum": "DKj+Sn+rlI48g/aoJpzkfPge46ya0jLk5kcZoiZ2X/I="
23+
},
24+
{
25+
"source": {
26+
"git": {
27+
"remote": "https://github.com/jsonnet-libs/docsonnet.git",
28+
"subdir": "doc-util"
29+
}
30+
},
31+
"version": "6ac6c69685b8c29c54515448eaca583da2d88150",
32+
"sum": "BrAL/k23jq+xy9oA7TWIhUx07dsA/QLm3g7ktCwe//U="
33+
},
34+
{
35+
"source": {
36+
"git": {
37+
"remote": "https://github.com/jsonnet-libs/xtd.git",
38+
"subdir": ""
39+
}
40+
},
41+
"version": "63d430b69a95741061c2f7fc9d84b1a778511d9c",
42+
"sum": "qiZi3axUSXCVzKUF83zSAxklwrnitMmrDK4XAfjPMdE="
43+
}
44+
],
45+
"legacyImports": false
46+
}

0 commit comments

Comments
 (0)