diff --git a/apisix/plugins/prometheus/exporter.lua b/apisix/plugins/prometheus/exporter.lua index 23699342ad16..603649d89b90 100644 --- a/apisix/plugins/prometheus/exporter.lua +++ b/apisix/plugins/prometheus/exporter.lua @@ -36,10 +36,7 @@ local get_protos = require("apisix.plugins.grpc-transcode.proto").protos -- Default set of latency buckets, 1ms to 60s: -local DEFAULT_BUCKETS = { 1, 2, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60, 70, - 80, 90, 100, 200, 300, 400, 500, 1000, - 2000, 5000, 10000, 30000, 60000 -} +local DEFAULT_BUCKETS = {1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 30000, 60000} local metrics = {} diff --git a/docs/assets/images/plugin/grafana-1.png b/docs/assets/images/plugin/grafana-1.png new file mode 100644 index 000000000000..1f65ab503532 Binary files /dev/null and b/docs/assets/images/plugin/grafana-1.png differ diff --git a/docs/assets/images/plugin/grafana-2.png b/docs/assets/images/plugin/grafana-2.png new file mode 100644 index 000000000000..2db20d1390f2 Binary files /dev/null and b/docs/assets/images/plugin/grafana-2.png differ diff --git a/docs/assets/images/plugin/grafana-3.png b/docs/assets/images/plugin/grafana-3.png new file mode 100644 index 000000000000..90304f111c2c Binary files /dev/null and b/docs/assets/images/plugin/grafana-3.png differ diff --git a/docs/assets/images/plugin/grafana_1.png b/docs/assets/images/plugin/grafana_1.png deleted file mode 100644 index 96006a76cdb7..000000000000 Binary files a/docs/assets/images/plugin/grafana_1.png and /dev/null differ diff --git a/docs/assets/images/plugin/grafana_2.png b/docs/assets/images/plugin/grafana_2.png deleted file mode 100644 index c5c7750d3e8d..000000000000 Binary files a/docs/assets/images/plugin/grafana_2.png and /dev/null differ diff --git a/docs/assets/images/plugin/grafana_3.png b/docs/assets/images/plugin/grafana_3.png deleted file mode 100644 index f50d948d56a5..000000000000 Binary files a/docs/assets/images/plugin/grafana_3.png and /dev/null differ diff --git a/docs/assets/other/json/apisix-grafana-dashboard.json b/docs/assets/other/json/apisix-grafana-dashboard.json index 62503d151d4e..191a21c7c707 100644 --- a/docs/assets/other/json/apisix-grafana-dashboard.json +++ b/docs/assets/other/json/apisix-grafana-dashboard.json @@ -1,9 +1,51 @@ { + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "7.3.7" + }, + { + "type": "panel", + "id": "graph", + "name": "Graph", + "version": "" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "singlestat", + "name": "Singlestat", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], "annotations": { "list": [ { "builtIn": 1, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -18,13 +60,13 @@ "editable": true, "gnetId": 11719, "graphTooltip": 0, - "id": 1, - "iteration": 1611470459709, + "id": null, + "iteration": 1616655621009, "links": [], "panels": [ { "collapsed": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "gridPos": { "h": 1, "w": 24, @@ -45,7 +87,7 @@ "rgba(237, 129, 40, 0.89)", "#d44a3a" ], - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "description": "", "fieldConfig": { "defaults": { @@ -63,7 +105,7 @@ }, "gridPos": { "h": 5, - "w": 5, + "w": 8, "x": 0, "y": 1 }, @@ -136,7 +178,7 @@ "rgba(237, 129, 40, 0.89)", "#d44a3a" ], - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "description": "", "fieldConfig": { "defaults": { @@ -154,8 +196,8 @@ }, "gridPos": { "h": 5, - "w": 5, - "x": 5, + "w": 8, + "x": 8, "y": 1 }, "id": 16, @@ -227,7 +269,7 @@ "rgba(237, 129, 40, 0.89)", "#d44a3a" ], - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "description": "", "fieldConfig": { "defaults": { @@ -245,8 +287,8 @@ }, "gridPos": { "h": 5, - "w": 5, - "x": 10, + "w": 8, + "x": 16, "y": 1 }, "id": 11, @@ -314,7 +356,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "fieldConfig": { "defaults": { "custom": {}, @@ -326,7 +368,7 @@ "fillGradient": 0, "gridPos": { "h": 6, - "w": 15, + "w": 24, "x": 0, "y": 6 }, @@ -361,6 +403,7 @@ "targets": [ { "expr": "sum(apisix_nginx_http_current_connections{state=~\"active|reading|writing|waiting\", instance=~\"$instance\"}) by (state)", + "instant": false, "interval": "", "intervalFactor": 1, "legendFormat": "{{state}}", @@ -387,7 +430,7 @@ }, "yaxes": [ { - "decimals": 0, + "decimals": null, "format": "short", "label": "", "logBase": 1, @@ -397,7 +440,7 @@ }, { "decimals": null, - "format": "short", + "format": "Misc", "label": "", "logBase": 1, "max": null, @@ -412,7 +455,7 @@ }, { "collapsed": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "gridPos": { "h": 1, "w": 24, @@ -429,7 +472,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "fieldConfig": { "defaults": { "custom": {}, @@ -441,7 +484,7 @@ "fillGradient": 0, "gridPos": { "h": 6, - "w": 15, + "w": 24, "x": 0, "y": 13 }, @@ -501,7 +544,7 @@ "yaxes": [ { "decimals": 0, - "format": "short", + "format": "decbytes", "label": null, "logBase": 1, "max": null, @@ -527,7 +570,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "fieldConfig": { "defaults": { "custom": {}, @@ -539,7 +582,7 @@ "fillGradient": 0, "gridPos": { "h": 6, - "w": 7, + "w": 12, "x": 0, "y": 19 }, @@ -602,7 +645,7 @@ "yaxes": [ { "decimals": 0, - "format": "short", + "format": "decbytes", "label": null, "logBase": 1, "max": null, @@ -628,7 +671,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "fieldConfig": { "defaults": { "custom": {}, @@ -640,8 +683,8 @@ "fillGradient": 0, "gridPos": { "h": 6, - "w": 8, - "x": 7, + "w": 12, + "x": 12, "y": 19 }, "hiddenSeries": false, @@ -703,7 +746,7 @@ "yaxes": [ { "decimals": 0, - "format": "short", + "format": "decbytes", "label": null, "logBase": 1, "max": null, @@ -726,7 +769,7 @@ }, { "collapsed": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "gridPos": { "h": 1, "w": 24, @@ -739,64 +782,252 @@ "type": "row" }, { - "datasource": null, + "aliasColors": {}, + "bars": false, + "cacheTimeout": null, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_PROMETHEUS}", + "description": "", "fieldConfig": { "defaults": { "custom": {}, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } + "links": [] }, "overrides": [] }, + "fill": 3, + "fillGradient": 0, "gridPos": { "h": 6, - "w": 23, + "w": 24, "x": 0, "y": 26 }, - "id": 27, + "hiddenSeries": false, + "id": 2, + "interval": "", + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", "options": { - "displayMode": "gradient", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false - }, - "showUnfilled": true + "alertThreshold": true }, + "percentage": false, "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "state", + "lines": true + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, "targets": [ { - "expr": "sum(apisix_http_latency_bucket{service=~\"$service\",consumer=~\"$consumer\",node=~\"$node\"}) by (le)", - "format": "heatmap", + "expr": "sum(rate(apisix_http_status{code=~\"2..\",service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[1m])) by (status_2xx)", + "instant": false, "interval": "", - "legendFormat": "{{le}}", + "intervalFactor": 1, + "legendFormat": "status_2xx", "refId": "A" + }, + { + "expr": "sum(rate(apisix_http_status{code=~\"3..\",service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[1m])) by (status_3xx)", + "interval": "", + "legendFormat": "status_3xx", + "refId": "D" + }, + { + "expr": "sum(rate(apisix_http_status{code=~\"4..\",service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[1m])) by (status_4xx)", + "interval": "", + "intervalFactor": 1, + "legendFormat": "status_4xx", + "refId": "B" + }, + { + "expr": "sum(rate(apisix_http_status{code=~\"5..\",service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[1m])) by (status_5xx)", + "interval": "", + "legendFormat": "status_5xx", + "refId": "C" } ], + "thresholds": [], "timeFrom": null, + "timeRegions": [], "timeShift": null, - "title": "HTTP Latency", - "type": "bargauge" + "title": "Requests per second (RPS)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } }, { - "datasource": null, + "aliasColors": {}, + "bars": false, + "cacheTimeout": null, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_PROMETHEUS}", "description": "", + "fieldConfig": { + "defaults": { + "custom": {}, + "links": [] + }, + "overrides": [] + }, + "fill": 3, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 24, + "x": 0, + "y": 32 + }, + "hiddenSeries": false, + "id": 32, + "interval": "", + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "state", + "lines": true + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(apisix_http_status{service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[1m])) by (service)", + "instant": false, + "interval": "", + "intervalFactor": 1, + "legendFormat": "service:{{service}}", + "refId": "A" + }, + { + "expr": "sum(rate(apisix_http_status{service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[1m])) by (route)", + "interval": "", + "legendFormat": "route:{{route}}", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Requests per second (RPS) per service/route", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "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": "${DS_PROMETHEUS}", "fieldConfig": { "defaults": { "custom": {}, @@ -817,65 +1048,139 @@ }, "overrides": [] }, + "fill": 1, + "fillGradient": 0, "gridPos": { "h": 6, - "w": 23, + "w": 24, "x": 0, - "y": 32 + "y": 38 }, - "id": 28, + "hiddenSeries": false, + "id": 27, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", "options": { - "displayMode": "gradient", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false - }, - "showUnfilled": true + "alertThreshold": true }, + "percentage": false, "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, "targets": [ { - "expr": "sum(apisix_http_overhead_bucket{service=~\"$service\",consumer=~\"$consumer\",node=~\"$node\"}) by (le)", - "format": "heatmap", + "expr": "histogram_quantile(0.90, sum(rate(apisix_http_latency_bucket{service=~\"$service\",consumer=~\"$consumer\",node=~\"$node\"}[1m])) by (le))", + "format": "time_series", "interval": "", - "legendFormat": "{{le}}", + "legendFormat": "P90", "refId": "A" + }, + { + "expr": "histogram_quantile(0.95, sum(rate(apisix_http_latency_bucket{service=~\"$service\",consumer=~\"$consumer\",node=~\"$node\"}[1m])) by (le))", + "interval": "", + "legendFormat": "P95", + "refId": "B" + }, + { + "expr": "histogram_quantile(0.99, sum(rate(apisix_http_latency_bucket{service=~\"$service\",consumer=~\"$consumer\",node=~\"$node\"}[1m])) by (le))", + "interval": "", + "legendFormat": "P99", + "refId": "C" } ], + "thresholds": [], "timeFrom": null, + "timeRegions": [], "timeShift": null, - "title": "HTTP Overhead", - "type": "bargauge" + "title": "HTTP Latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "ms", + "label": "", + "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, - "cacheTimeout": null, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", + "description": "", "fieldConfig": { "defaults": { "custom": {}, - "links": [] + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } }, "overrides": [] }, - "fill": 3, + "fill": 1, "fillGradient": 0, "gridPos": { "h": 6, - "w": 15, + "w": 24, "x": 0, - "y": 38 + "y": 44 }, "hiddenSeries": false, - "id": 2, - "interval": "", + "id": 28, "legend": { "avg": false, "current": false, @@ -887,7 +1192,6 @@ }, "lines": true, "linewidth": 1, - "links": [], "nullPointMode": "null", "options": { "alertThreshold": true @@ -897,41 +1201,30 @@ "pointradius": 2, "points": false, "renderer": "flot", - "seriesOverrides": [ - { - "alias": "state", - "lines": true - } - ], + "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { - "expr": "sum(rate(apisix_http_status{code=~\"2..\",service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[30s])) by (status_2xx)", + "expr": "histogram_quantile(0.90, sum(rate(apisix_http_overhead_bucket{service=~\"$service\",consumer=~\"$consumer\",node=~\"$node\"}[1m])) by (le))", + "format": "time_series", "instant": false, "interval": "", "intervalFactor": 1, - "legendFormat": "status_2xx", + "legendFormat": "P90", "refId": "A" }, { - "expr": "sum(rate(apisix_http_status{code=~\"3..\",service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[30s])) by (status_3xx)", - "interval": "", - "legendFormat": "status_3xx", - "refId": "D" - }, - { - "expr": "sum(rate(apisix_http_status{code=~\"4..\",service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[30s])) by (status_4xx)", + "expr": "histogram_quantile(0.95, sum(rate(apisix_http_overhead_bucket{service=~\"$service\",consumer=~\"$consumer\",node=~\"$node\"}[1m])) by (le))", "interval": "", - "intervalFactor": 1, - "legendFormat": "status_4xx", + "legendFormat": "P95", "refId": "B" }, { - "expr": "sum(rate(apisix_http_status{code=~\"5..\",service=~\"$service\",route=~\"$route\",instance=~\"$instance\"}[30s])) by (status_5xx)", + "expr": "histogram_quantile(0.99, sum(rate(apisix_http_overhead_bucket{service=~\"$service\",consumer=~\"$consumer\",node=~\"$node\"}[1m])) by (le))", "interval": "", - "legendFormat": "status_5xx", + "legendFormat": "P99", "refId": "C" } ], @@ -939,7 +1232,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Service HTTP Code", + "title": "HTTP Overhead", "tooltip": { "shared": true, "sort": 0, @@ -955,12 +1248,11 @@ }, "yaxes": [ { - "decimals": 0, - "format": "short", + "format": "ms", "label": null, "logBase": 1, "max": null, - "min": "0", + "min": null, "show": true }, { @@ -979,12 +1271,12 @@ }, { "collapsed": false, - "datasource": null, + "datasource": "${DS_PROMETHEUS}", "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 44 + "y": 50 }, "id": 23, "panels": [], @@ -992,7 +1284,7 @@ "type": "row" }, { - "datasource": null, + "datasource": "${DS_PROMETHEUS}", "fieldConfig": { "defaults": { "custom": {}, @@ -1018,10 +1310,10 @@ "overrides": [] }, "gridPos": { - "h": 5, - "w": 3, + "h": 3, + "w": 4, "x": 0, - "y": 45 + "y": 51 }, "id": 25, "options": { @@ -1052,69 +1344,12 @@ "title": "Etcd reachable", "type": "stat" }, - { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {}, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "yellow", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 5, - "w": 3, - "x": 3, - "y": 45 - }, - "id": 29, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "7.3.7", - "targets": [ - { - "expr": "sum(apisix_nginx_metric_errors_total{instance=~\"$instance\"})", - "interval": "", - "legendFormat": "", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Nginx metric errors", - "type": "stat" - }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "fieldConfig": { "defaults": { "custom": {}, @@ -1126,9 +1361,9 @@ "fillGradient": 0, "gridPos": { "h": 6, - "w": 15, - "x": 0, - "y": 50 + "w": 10, + "x": 4, + "y": 51 }, "hiddenSeries": false, "id": 30, @@ -1215,7 +1450,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "${DS_PROMETHEUS}", "fieldConfig": { "defaults": { "custom": {}, @@ -1227,9 +1462,9 @@ "fillGradient": 0, "gridPos": { "h": 6, - "w": 15, - "x": 0, - "y": 56 + "w": 10, + "x": 14, + "y": 51 }, "hiddenSeries": false, "id": 31, @@ -1310,6 +1545,63 @@ "align": false, "alignLevel": null } + }, + { + "datasource": "${DS_PROMETHEUS}", + "fieldConfig": { + "defaults": { + "custom": {}, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "yellow", + "value": 1 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 0, + "y": 54 + }, + "id": 29, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "7.3.7", + "targets": [ + { + "expr": "sum(apisix_nginx_metric_errors_total{instance=~\"$instance\"})", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Nginx metric errors", + "type": "stat" } ], "refresh": "5s", @@ -1320,12 +1612,8 @@ "list": [ { "allValue": ".*", - "current": { - "selected": false, - "text": "All", - "value": "$__all" - }, - "datasource": "Prometheus", + "current": {}, + "datasource": "${DS_PROMETHEUS}", "definition": "label_values(apisix_http_status,service)", "error": null, "hide": 0, @@ -1347,12 +1635,8 @@ }, { "allValue": ".*", - "current": { - "selected": false, - "text": "All", - "value": "$__all" - }, - "datasource": "Prometheus", + "current": {}, + "datasource": "${DS_PROMETHEUS}", "definition": "label_values(apisix_http_status,route)", "error": null, "hide": 0, @@ -1374,12 +1658,8 @@ }, { "allValue": ".*", - "current": { - "selected": false, - "text": "All", - "value": "$__all" - }, - "datasource": "Prometheus", + "current": {}, + "datasource": "${DS_PROMETHEUS}", "definition": "label_values(apisix_http_status,instance)", "error": null, "hide": 0, @@ -1401,12 +1681,8 @@ }, { "allValue": ".*", - "current": { - "selected": false, - "text": "All", - "value": "$__all" - }, - "datasource": "Prometheus", + "current": {}, + "datasource": "${DS_PROMETHEUS}", "definition": "label_values(apisix_http_status,consumer)", "error": null, "hide": 0, @@ -1428,12 +1704,8 @@ }, { "allValue": ".*", - "current": { - "selected": false, - "text": "All", - "value": "$__all" - }, - "datasource": "Prometheus", + "current": {}, + "datasource": "${DS_PROMETHEUS}", "definition": "label_values(apisix_http_status,node)", "error": null, "hide": 0, @@ -1456,7 +1728,7 @@ ] }, "time": { - "from": "now-30m", + "from": "now-12h", "to": "now" }, "timepicker": { @@ -1476,5 +1748,5 @@ "timezone": "", "title": "Apache APISIX", "uid": "bLlNuRLWz", - "version": 4 -} \ No newline at end of file + "version": 9 +} diff --git a/docs/en/latest/plugins/prometheus.md b/docs/en/latest/plugins/prometheus.md index 75efbb09177e..1b389eb02bba 100644 --- a/docs/en/latest/plugins/prometheus.md +++ b/docs/en/latest/plugins/prometheus.md @@ -114,11 +114,11 @@ Downloads [Grafana dashboard meta](../../../assets/other/json/apisix-grafana-das Or you can goto [Grafana official](https://grafana.com/grafana/dashboards/11719) for `Grafana` meta data. -![](../../../assets/images/plugin/grafana_1.png) +![](../../../assets/images/plugin/grafana-1.png) -![](../../../assets/images/plugin/grafana_2.png) +![](../../../assets/images/plugin/grafana-2.png) -![](../../../assets/images/plugin/grafana_3.png) +![](../../../assets/images/plugin/grafana-3.png) ### Available metrics @@ -185,13 +185,13 @@ apisix_nginx_http_current_connections{state="writing"} 1 apisix_nginx_metric_errors_total 0 # HELP apisix_http_latency HTTP request latency in milliseconds per service in APISIX # TYPE apisix_http_latency histogram -apisix_http_latency_bucket{type="request",service="",consumer="",node="127.0.0.1",le="00001.0"} 1 -apisix_http_latency_bucket{type="request",service="",consumer="",node="127.0.0.1",le="00002.0"} 1 +apisix_http_latency_bucket{type="request",service="",consumer="",node="127.0.0.1",le="1"} 1 +apisix_http_latency_bucket{type="request",service="",consumer="",node="127.0.0.1",le="2"} 1 ... # HELP apisix_http_overhead HTTP request overhead added by APISIX in milliseconds per service in APISIX # TYPE apisix_http_overhead histogram -apisix_http_overhead_bucket{type="request",service="",consumer="",node="127.0.0.1",le="00001.0"} 1 -apisix_http_overhead_bucket{type="request",service="",consumer="",node="127.0.0.1",le="00002.0"} 1 +apisix_http_overhead_bucket{type="request",service="",consumer="",node="127.0.0.1",le="1"} 1 +apisix_http_overhead_bucket{type="request",service="",consumer="",node="127.0.0.1",le="2"} 1 ... # HELP apisix_node_info Info of APISIX node # TYPE apisix_node_info gauge diff --git a/docs/zh/latest/plugins/prometheus.md b/docs/zh/latest/plugins/prometheus.md index cdd521d015c5..2a8ca0a189c5 100644 --- a/docs/zh/latest/plugins/prometheus.md +++ b/docs/zh/latest/plugins/prometheus.md @@ -112,11 +112,11 @@ plugin_attr: 你可以到 [Grafana 官方](https://grafana.com/grafana/dashboards/11719) 下载 `Grafana` 元数据. -![](../../../assets/images/plugin/grafana_1.png) +![](../../../assets/images/plugin/grafana-1.png) -![](../../../assets/images/plugin/grafana_2.png) +![](../../../assets/images/plugin/grafana-2.png) -![](../../../assets/images/plugin/grafana_3.png) +![](../../../assets/images/plugin/grafana-3.png) ### 可有的指标 @@ -183,13 +183,13 @@ apisix_nginx_http_current_connections{state="writing"} 1 apisix_nginx_metric_errors_total 0 # HELP apisix_http_latency HTTP request latency in milliseconds per service in APISIX # TYPE apisix_http_latency histogram -apisix_http_latency_bucket{type="request",service="",consumer="",node="127.0.0.1",le="00001.0"} 1 -apisix_http_latency_bucket{type="request",service="",consumer="",node="127.0.0.1",le="00002.0"} 1 +apisix_http_latency_bucket{type="request",service="",consumer="",node="127.0.0.1",le="1"} 1 +apisix_http_latency_bucket{type="request",service="",consumer="",node="127.0.0.1",le="2"} 1 ... # HELP apisix_http_overhead HTTP request overhead added by APISIX in milliseconds per service in APISIX # TYPE apisix_http_overhead histogram -apisix_http_overhead_bucket{type="request",service="",consumer="",node="127.0.0.1",le="00001.0"} 1 -apisix_http_overhead_bucket{type="request",service="",consumer="",node="127.0.0.1",le="00002.0"} 1 +apisix_http_overhead_bucket{type="request",service="",consumer="",node="127.0.0.1",le="1"} 1 +apisix_http_overhead_bucket{type="request",service="",consumer="",node="127.0.0.1",le="2"} 1 ... # HELP apisix_node_info Info of APISIX node # TYPE apisix_node_info gauge diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-master-0.rockspec index 52d559c47fd4..dea89336227d 100644 --- a/rockspec/apisix-master-0.rockspec +++ b/rockspec/apisix-master-0.rockspec @@ -49,7 +49,7 @@ dependencies = { "lua-resty-openidc = 1.7.2-1", "luafilesystem = 1.7.0-2", "lua-tinyyaml = 1.0", - "nginx-lua-prometheus = 0.20201218", + "nginx-lua-prometheus = 0.20210206", "jsonschema = 0.9.5", "lua-resty-ipmatcher = 0.6", "lua-resty-kafka = 0.07", diff --git a/t/plugin/prometheus.t b/t/plugin/prometheus.t index bd37270b34f8..51d73eec1b44 100644 --- a/t/plugin/prometheus.t +++ b/t/plugin/prometheus.t @@ -614,7 +614,7 @@ passed --- request GET /apisix/prometheus/metrics --- response_body eval -qr/apisix_http_overhead_bucket.*service=\"3\".*le=\"00500.0.*/ +qr/apisix_http_overhead_bucket.*service=\"3\".*le=\"500.*/ --- no_error_log [error]