Skip to content

Commit

Permalink
Make Graphpanel more user friendly
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <[email protected]>
  • Loading branch information
roidelapluie committed Dec 24, 2017
1 parent aaa9c1a commit 0d9c2df
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
34 changes: 17 additions & 17 deletions examples/jvm.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,21 @@ grafana.dashboard.new(
legend_avg=true,
legend_alignAsTable=true,
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_bytes_max{env=\"$env\",job=\"$job\",instance=\"$instance\",area=\"heap\"}",
datasource="$PROMETHEUS_DS",
legendFormat="max"
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_bytes_used{env=\"$env\",job=\"$job\",instance=\"$instance\",area=\"heap\"}",
datasource="$PROMETHEUS_DS",
legendFormat="used"
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_bytes_committed{env=\"$env\",job=\"$job\",instance=\"$instance\",area=\"heap\"}",
datasource="$PROMETHEUS_DS",
Expand All @@ -238,21 +238,21 @@ grafana.dashboard.new(
legend_avg=true,
legend_alignAsTable=true,
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_bytes_max{env=\"$env\",job=\"$job\",instance=\"$instance\",area=\"nonheap\"}",
datasource="$PROMETHEUS_DS",
legendFormat="max"
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_bytes_used{env=\"$env\",job=\"$job\",instance=\"$instance\",area=\"nonheap\"}",
datasource="$PROMETHEUS_DS",
legendFormat="used"
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_bytes_committed{env=\"$env\",job=\"$job\",instance=\"$instance\",area=\"nonheap\"}",
datasource="$PROMETHEUS_DS",
Expand Down Expand Up @@ -284,21 +284,21 @@ grafana.dashboard.new(
legend_avg=true,
legend_alignAsTable=true,
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_pool_bytes_max{env=\"$env\",job=\"$job\",instance=\"$instance\",pool=\"$pool\"}",
datasource="$PROMETHEUS_DS",
legendFormat="max",
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_pool_bytes_used{env=\"$env\",job=\"$job\",instance=\"$instance\",pool=\"$pool\"}",
datasource="$PROMETHEUS_DS",
legendFormat="used",
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_memory_pool_bytes_committed{env=\"$env\",job=\"$job\",instance=\"$instance\",pool=\"$pool\"}",
datasource="$PROMETHEUS_DS",
Expand Down Expand Up @@ -330,7 +330,7 @@ grafana.dashboard.new(
legend_avg=true,
legend_alignAsTable=true,
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"increase(jvm_gc_collection_seconds_count{env=\"$env\",job=\"$job\",instance=\"$instance\",gc=\"$gc\"}[5m])",
datasource="$PROMETHEUS_DS",
Expand All @@ -356,7 +356,7 @@ grafana.dashboard.new(
legend_avg=true,
legend_alignAsTable=true,
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"rate(jvm_gc_collection_seconds_sum{env=\"$env\",job=\"$job\",instance=\"$instance\",gc=\"$gc\"}[5m])/rate(jvm_gc_collection_seconds_count{env=\"$env\",job=\"$job\",instance=\"$instance\",gc=\"$gc\"}[5m])",
datasource="$PROMETHEUS_DS",
Expand Down Expand Up @@ -387,35 +387,35 @@ grafana.dashboard.new(
legend_avg=true,
legend_alignAsTable=true,
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_threads_peak{env=\"$env\",job=\"$job\",instance=\"$instance\"}",
datasource="$PROMETHEUS_DS",
legendFormat="Peak thread count",
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_threads_current{env=\"$env\",job=\"$job\",instance=\"$instance\"}",
datasource="$PROMETHEUS_DS",
legendFormat="Current thread count",
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_threads_daemon{env=\"$env\",job=\"$job\",instance=\"$instance\"}",
datasource="$PROMETHEUS_DS",
legendFormat="Daemon thread count",
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_threads_deadlocked{env=\"$env\",job=\"$job\",instance=\"$instance\"}",
datasource="$PROMETHEUS_DS",
legendFormat="Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers",
)
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"jvm_threads_deadlocked_monitor{env=\"$env\",job=\"$job\",instance=\"$instance\"}",
datasource="$PROMETHEUS_DS",
Expand All @@ -441,7 +441,7 @@ grafana.dashboard.new(
legend_avg=true,
legend_alignAsTable=true,
)
+ graphPanel.addTarget(
.addTarget(
prometheus.target(
"rate(jvm_threads_started_total{env=\"$env\",job=\"$job\",instance=\"$instance\"}[5m])",
datasource="$PROMETHEUS_DS",
Expand Down
44 changes: 22 additions & 22 deletions grafonnet/graph_panel.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
[if height != null then "height"]: height,
renderer: "flot",
yaxes: [
$.yaxe(format, min, max, decimals=decimals),
$.yaxe(format, min, max, decimals=decimals),
self.yaxe(format, min, max, decimals=decimals),
self.yaxe(format, min, max, decimals=decimals),
],
xaxis: {
show: show_xaxis,
Expand Down Expand Up @@ -124,25 +124,25 @@
[if repeatDirection != null then "repeatDirection"]: repeatDirection,
seriesOverrides: [],
thresholds: [],
},
yaxe(
format="short",
min=null,
max=null,
label=null,
show=true,
logBase=1,
decimals=null,
):: {
label: label,
show: show,
logBase: logBase,
min: min,
max: max,
format: format,
[if decimals != null then "decimals"]: decimals,
},
addTarget(target):: {
targets+: [target],
yaxe(
format="short",
min=null,
max=null,
label=null,
show=true,
logBase=1,
decimals=null,
):: {
label: label,
show: show,
logBase: logBase,
min: min,
max: max,
format: format,
[if decimals != null then "decimals"]: decimals,
},
addTarget(target):: self {
targets+: [target],
},
},
}
4 changes: 2 additions & 2 deletions tests/graph_panel/test.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ local graphPanel = grafana.graphPanel;
legend_hideZero=true,
),
targets: graphPanel.new("with targets")
+ graphPanel.addTarget("foo")
+ graphPanel.addTarget("foo"),
.addTarget("foo")
.addTarget("foo"),
}

0 comments on commit 0d9c2df

Please sign in to comment.