Add dashboard in api gateway

This commit is contained in:
Lucian Popescu 2022-05-21 20:31:47 +03:00
parent e2b87ac12a
commit 8b92ade9af
4 changed files with 186 additions and 210 deletions

View File

@ -47,12 +47,15 @@ services:
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_SERVER_ROOT_URL=http://localhost:8000/dashboard
- DS_PROMETHEUS=prometheus
ports:
- 3000:3000
expose:
- 3000
networks:
- monitoring
- kong-internal
rabbitmq:
image: rabbitmq:3.7.4

View File

@ -46,12 +46,15 @@ services:
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_SERVER_ROOT_URL=http://localhost:8000/dashboard
- DS_PROMETHEUS=prometheus
ports:
- 3000:3000
expose:
- 3000
networks:
- monitoring
- kong-internal
rabbitmq:
image: rabbitmq:3.7.4

View File

@ -1,4 +1,40 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "6.0.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": "5.0.0"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "5.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": "5.0.0"
}
],
"annotations": {
"list": [
{
@ -16,8 +52,8 @@
"editable": true,
"gnetId": 11159,
"graphTooltip": 0,
"id": 18,
"iteration": 1598203753988,
"id": null,
"iteration": 1573392431370,
"links": [],
"panels": [
{
@ -26,21 +62,13 @@
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 10,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 6,
"legend": {
"alignAsTable": true,
@ -56,33 +84,27 @@
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "irate(process_cpu_user_seconds_total[1m]) * 100",
"expr": "irate(process_cpu_user_seconds_total{instance=~\"$instance\"}[2m]) * 100",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "User CPU - {{pod_name}}",
"legendFormat": "User CPU - {{instance}}",
"refId": "A"
},
{
"expr": "irate(process_cpu_system_seconds_total[1m]) * 100",
"expr": "irate(process_cpu_system_seconds_total{instance=~\"$instance\"}[2m]) * 100",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "Sys CPU - {{pod_name}}",
"legendFormat": "Sys CPU - {{instance}}",
"refId": "B"
}
],
@ -133,21 +155,13 @@
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 9,
"x": 10,
"y": 0
},
"hiddenSeries": false,
"id": 8,
"legend": {
"alignAsTable": true,
@ -163,25 +177,20 @@
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "nodejs_eventloop_lag_seconds",
"expr": "nodejs_eventloop_lag_seconds{instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{pod_name}}",
"legendFormat": "{{instance}}",
"refId": "A"
}
],
@ -236,12 +245,6 @@
"#d44a3a"
],
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "none",
"gauge": {
"maxValue": 100,
@ -293,7 +296,7 @@
"tableColumn": "__name__",
"targets": [
{
"expr": "sum(nodejs_version_info) by (version)",
"expr": "sum(nodejs_version_info{instance=~\"$instance\"}) by (version)",
"format": "time_series",
"instant": false,
"interval": "",
@ -327,12 +330,6 @@
"#d44a3a"
],
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "none",
"gauge": {
"maxValue": 100,
@ -384,11 +381,10 @@
"tableColumn": "",
"targets": [
{
"expr": "sum(changes(process_start_time_seconds[1m]))",
"expr": "sum(changes(process_start_time_seconds{instance=~\"$instance\"}[1m]))",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{pod_name}}",
"legendFormat": "{{instance}}",
"refId": "A"
}
],
@ -413,21 +409,13 @@
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 10,
"w": 12,
"h": 7,
"w": 16,
"x": 0,
"y": 7
},
"hiddenSeries": false,
"id": 7,
"legend": {
"alignAsTable": true,
@ -435,7 +423,7 @@
"current": true,
"max": true,
"min": true,
"rightSide": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
@ -444,45 +432,38 @@
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "process_resident_memory_bytes",
"expr": "process_resident_memory_bytes{instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "Process Memory - {{pod_name}}",
"legendFormat": "Process Memory - {{instance}}",
"refId": "A"
},
{
"expr": "nodejs_heap_size_total_bytes",
"expr": "nodejs_heap_size_total_bytes{instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "Heap Total - {{pod_name}}",
"legendFormat": "Heap Total - {{instance}}",
"refId": "B"
},
{
"expr": "nodejs_heap_size_used_bytes",
"expr": "nodejs_heap_size_used_bytes{instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "Heap Used - {{pod_name}}",
"legendFormat": "Heap Used - {{instance}}",
"refId": "C"
},
{
"expr": "nodejs_external_memory_bytes",
"expr": "nodejs_external_memory_bytes{instance=~\"$instance\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "External Memory - {{instance}}",
@ -536,21 +517,13 @@
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 10,
"w": 12,
"x": 12,
"h": 7,
"w": 8,
"x": 16,
"y": 7
},
"hiddenSeries": false,
"id": 9,
"legend": {
"alignAsTable": true,
@ -566,33 +539,27 @@
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "nodejs_active_handles_total",
"expr": "nodejs_active_handles_total{instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "Active Handler - {{pod_name}}",
"legendFormat": "Active Handler - {{instance}}",
"refId": "A"
},
{
"expr": "nodejs_active_requests_total",
"expr": "nodejs_active_requests_total{instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "Active Request - {{pod_name}}",
"legendFormat": "Active Request - {{instance}}",
"refId": "B"
}
],
@ -643,28 +610,21 @@
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 10,
"w": 12,
"h": 8,
"w": 8,
"x": 0,
"y": 17
"y": 14
},
"hiddenSeries": false,
"id": 11,
"id": 10,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": false,
"show": true,
"total": false,
"values": true
@ -673,47 +633,28 @@
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(nodejs_gc_duration_seconds_count[1m])",
"expr": "nodejs_heap_space_size_total_bytes{instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "minor : {{pod_name}}",
"legendFormat": "Heap Total - {{instance}} - {{space}}",
"refId": "A"
},
{
"expr": "rate(nodejs_gc_duration_seconds_count[1m])",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "incremental : {{pod_name}}",
"refId": "B"
},
{
"expr": "rate(nodejs_gc_duration_seconds_count[1m])",
"interval": "",
"legendFormat": "major : {{pod_name}}",
"refId": "C"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "GC Counts",
"title": "Heap Total Detail",
"tooltip": {
"shared": true,
"sort": 0,
@ -729,7 +670,7 @@
},
"yaxes": [
{
"format": "short",
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
@ -756,28 +697,21 @@
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 10,
"w": 12,
"x": 12,
"y": 17
"h": 8,
"w": 8,
"x": 8,
"y": 14
},
"hiddenSeries": false,
"id": 10,
"id": 11,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": false,
"show": true,
"total": false,
"values": true
@ -786,45 +720,28 @@
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(nodejs_gc_duration_seconds_sum[1m])",
"expr": "nodejs_heap_space_size_used_bytes{instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 1,
"legendFormat": "minor : {{pod_name}}",
"legendFormat": "Heap Used - {{instance}} - {{space}}",
"refId": "A"
},
{
"expr": "rate(nodejs_gc_duration_seconds_sum[1m])",
"interval": "",
"legendFormat": "incremental : {{pod_name}}",
"refId": "B"
},
{
"expr": "rate(nodejs_gc_duration_seconds_sum[1m])",
"interval": "",
"legendFormat": "major : {{pod_name}}",
"refId": "C"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "GC time",
"title": "Heap Used Detail",
"tooltip": {
"shared": true,
"sort": 0,
@ -840,7 +757,94 @@
},
"yaxes": [
{
"format": "s",
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fill": 1,
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 14
},
"id": 12,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "nodejs_heap_space_size_available_bytes{instance=~\"$instance\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "Heap Used - {{instance}} - {{space}}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Heap Available Detail",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
@ -862,7 +866,7 @@
}
}
],
"schemaVersion": 25,
"schemaVersion": 18,
"style": "dark",
"tags": [
"nodejs"
@ -871,22 +875,16 @@
"list": [
{
"allValue": null,
"current": {
"selected": true,
"text": "All",
"value": [
"$__all"
]
},
"current": {},
"datasource": "Prometheus",
"definition": "label_values(nodejs_active_handles_total, namespace)",
"definition": "label_values(nodejs_version_info, instance)",
"hide": 0,
"includeAll": true,
"label": "namespace",
"label": "instance",
"multi": true,
"name": "namespace",
"name": "instance",
"options": [],
"query": "label_values(nodejs_active_handles_total, namespace)",
"query": "label_values(nodejs_version_info, instance)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
@ -896,44 +894,16 @@
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"selected": true,
"tags": [],
"text": "front-end-7c7b997dbb-pbrwh",
"value": [
"front-end-7c7b997dbb-pbrwh"
]
},
"datasource": "Prometheus",
"definition": "label_values(nodejs_active_handles_total{namespace=\"$namespace\"},pod_name)",
"hide": 0,
"includeAll": false,
"label": "pod",
"multi": true,
"name": "pod",
"options": [],
"query": "label_values(nodejs_active_handles_total{namespace=\"$namespace\"},pod_name)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-30m",
"from": "now-1h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
@ -959,5 +929,5 @@
"timezone": "",
"title": "NodeJS Application Dashboard",
"uid": "PTSqcpJWk",
"version": 9
"version": 4
}

View File

@ -50,7 +50,7 @@ services:
paths:
- /get_questions_by_id
- name: dashboard
url: http://grafana:3000/dashboard
url: http://grafana:3000
routes:
- name: dashboard-route
paths: