Skip to content

Commit

Permalink
dashboards/.*.json to jinja2 (#47)
Browse files Browse the repository at this point in the history
Main intent was to extend the JSON dashboards to support more dynamic "job" names and to be able to switch out "instance" dashboard legends with "pod" keys.

After this update most of the dashboards under dashboards/ are Jinja2 templates and the generate_dashboard.sh script
now supports checking for and prompting if missing input/env vars which also resolves issue #45

Visual verification of post rendered templates was done.
  • Loading branch information
jharris- authored Jul 28, 2020
1 parent 8633246 commit 136275c
Show file tree
Hide file tree
Showing 9 changed files with 350 additions and 254 deletions.
151 changes: 80 additions & 71 deletions dashboards/bookkeeper.json → dashboards/bookkeeper.json.j2

Large diffs are not rendered by default.

27 changes: 18 additions & 9 deletions dashboards/jvm.json → dashboards/jvm.json.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{%- if PULSAR_CUSTOM_PROMETHEUS not in [ '','no','No','NO','na','NA','false','False','0' ] %}
{#-
If custom change "instance" key to "pod"
This will make graph ledgends display the pod name instead of IP and port information
#}
{%- set CONTEXT = "pod" %}
{%- else %}
{%- set CONTEXT = "instance" %}
{%- endif -%}
{
"__inputs": [
{
Expand Down Expand Up @@ -102,11 +111,11 @@
"steppedLine": false,
"targets": [
{
"expr": "irate(process_cpu_seconds_total{instance=~\"$instance\"}[30s]) * 100\n\n",
"expr": "irate(process_cpu_seconds_total{{ '{' }}{{ CONTEXT }}=~\"$instance\"}[30s]) * 100\n\n",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{instance}}",
"legendFormat": "{{ '{{' }} {{ CONTEXT }} {{ '}}' }}",
"metric": "process_cpu_seconds_total",
"refId": "A",
"step": 20
Expand Down Expand Up @@ -200,7 +209,7 @@
"steppedLine": false,
"targets": [
{
"expr": "sum(jvm_memory_bytes_committed{instance=~\"$instance\"})",
"expr": "sum(jvm_memory_bytes_committed{{ '{' }}{{ CONTEXT }}=~\"$instance\"})",
"format": "time_series",
"hide": false,
"interval": "",
Expand All @@ -211,7 +220,7 @@
"step": 20
},
{
"expr": "sum(jvm_memory_bytes_used{instance=~\"$instance\"})",
"expr": "sum(jvm_memory_bytes_used{{ '{' }}{{ CONTEXT }}=~\"$instance\"})",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
Expand All @@ -221,7 +230,7 @@
"step": 20
},
{
"expr": "sum(jvm_memory_bytes_max{instance=~\"$instance\"})",
"expr": "sum(jvm_memory_bytes_max{{ '{' }}{{ CONTEXT }}=~\"$instance\"})",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
Expand Down Expand Up @@ -308,7 +317,7 @@
"steppedLine": false,
"targets": [
{
"expr": "jvm_memory_direct_bytes_used{instance=~\"$instance\"}",
"expr": "jvm_memory_direct_bytes_used{{ '{' }}{{ CONTEXT }}=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
Expand All @@ -318,7 +327,7 @@
"step": 20
},
{
"expr": "jvm_memory_direct_bytes_max{instance=~\"$instance\"}",
"expr": "jvm_memory_direct_bytes_max{{ '{' }}{{ CONTEXT }}=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
Expand Down Expand Up @@ -414,7 +423,7 @@
"steppedLine": false,
"targets": [
{
"expr": "sum(increase(jvm_gc_collection_seconds_sum{instance=~\"$instance\"}[30s]))",
"expr": "sum(increase(jvm_gc_collection_seconds_sum{{ '{' }}{{ CONTEXT }}=~\"$instance\"}[30s]))",
"format": "time_series",
"hide": false,
"interval": "",
Expand Down Expand Up @@ -526,7 +535,7 @@
"multi": true,
"name": "instance",
"options": [],
"query": "jvm_memory_bytes_used{job=~\"$job\", instance=~\".+\"}",
"query": "jvm_memory_bytes_used{job=~\"$job\", {{ CONTEXT }}=~\".+\"}",
"refresh": 2,
"regex": "/.*[^_]instance=\\\"([^\\\"]+)\\\".*/",
"skipUrlSync": false,
Expand Down
Loading

0 comments on commit 136275c

Please sign in to comment.