forked from K-Phoen/grabana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
55 lines (52 loc) · 1.52 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
Package grabana provides a developer-friendly way of creating Grafana dashboards.
Whether you prefer writing **code or YAML**, if you are looking for a way to
version your dashboards configuration or automate tedious and error-prone
creation of dashboards, this library is meant for you.
builder := dashboard.New(
"Awesome dashboard",
dashboard.VariableAsInterval(
"interval",
interval.Values([]string{"30s", "1m", "5m", "10m", "30m", "1h", "6h", "12h"}),
),
dashboard.VariableAsQuery(
"status",
query.DataSource("prometheus-default"),
query.Request("label_values(prometheus_http_requests_total, code)"),
query.Sort(query.NumericalAsc),
),
dashboard.Row(
"Prometheus",
row.WithTimeSeries(
"HTTP Rate",
timeseries.WithPrometheusTarget(
"rate(promhttp_metric_handler_requests_total[$interval])",
prometheus.Legend("{{handler}} - {{ code }}"),
),
),
row.WithTable(
"Threads",
table.WithPrometheusTarget("go_threads"),
table.HideColumn("Time"),
table.AsTimeSeriesAggregations([]table.Aggregation{
{Label: "AVG", Type: table.AVG},
{Label: "Current", Type: table.Current},
}),
),
row.WithStat(
"Heap Allocations",
stat.Unit("bytes"),
stat.WithPrometheusTarget("go_memstats_heap_alloc_bytes"),
),
),
dashboard.Row(
"Some text, because it might be useful",
row.WithText(
"Some awesome html?",
text.HTML("<b>lalalala</b>"),
),
),
)
For a more information visit https://github.com/K-Phoen/grabana
*/
package grabana