diff --git a/README.md b/README.md index b57ba1b..328b723 100644 --- a/README.md +++ b/README.md @@ -366,6 +366,7 @@ This data is also reported to the console at the end of each test. ## Time Series DB Reporting and Tagging + When you specify a time series database URL param to `launch_test`, such as `influx_host`, all metrics will be automatically reported to tables within the `locust` timeseries database via the specified URL. These tables include: @@ -374,8 +375,14 @@ timeseries database via the specified URL. These tables include: - `locust_exceptions`: error messages - `locust_requests`: HTTP requests and custom trends -An example grafana dashboard which queries these tables can be found in -`example/grafana_dashboards` +To run the influxdb/grafana locally, you can use the docker-compose file in the example directory: +```shell +cd example/observability_infrastructure +docker-compose up -d +``` +and then you can access the grafana UI at `localhost`. The default username/password is `admin/admin`. +To then run a test which reports to this influxdb just add the `--influx_host=localhost` handle. + There are a few ways you can pass in extra tags which will be reported to the time series DB: @@ -435,6 +442,7 @@ will be reported to the time series DB: - [X] Thresholds - [X] Tagging - [X] InfluxDB metric reporting +- [X] docker-compose template for influxdb/grafana - [ ] PrometheusDB metric reporting - [ ] Slack reporting - [ ] ReportPortal reporting diff --git a/example/grafana_dashboards/example_grafana_dashboard.json b/example/grafana_dashboards/example_grafana_dashboard.json deleted file mode 100644 index bcaa142..0000000 --- a/example/grafana_dashboards/example_grafana_dashboard.json +++ /dev/null @@ -1,1422 +0,0 @@ -{ - "annotations": { - "list": [ - { - "$$hashKey": "object:10", - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": 10, - "iteration": 1678226744476, - "links": [], - "liveNow": false, - "panels": [ - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 58, - "panels": [], - "title": "Custom Trends and Checks", - "type": "row" - }, - { - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "points", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 4, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 1 - }, - "id": 39, - "options": { - "legend": { - "calcs": [ - "mean", - "min", - "max" - ], - "displayMode": "table", - "placement": "right" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.4.4", - "targets": [ - { - "alias": " $tag_name", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "query": "SELECT DISTINCT \"response_time\"\nFROM \"locust_requests\"\nWHERE $timeFilter and \"request_type\"='CUSTOM'\nGROUP BY \"name\"", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series" - } - ], - "title": "Custom Trends", - "type": "timeseries" - }, - { - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "max": 1, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "orange", - "value": 0.5 - }, - { - "color": "green", - "value": 0.95 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 11, - "w": 7, - "x": 0, - "y": 9 - }, - "id": 59, - "options": { - "displayMode": "basic", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "text": {} - }, - "pluginVersion": "8.4.4", - "targets": [ - { - "alias": "$tag_check_name", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "query": "SELECT mean(\"check_passed\") FROM \"locust_checks\" WHERE $timeFilter GROUP BY \"check_name\"\n", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series" - } - ], - "title": "Check success rates", - "type": "bargauge" - }, - { - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "transparent", - "mode": "fixed" - }, - "mappings": [ - { - "options": { - "No data": { - "index": 0, - "text": "0" - } - }, - "type": "value" - } - ], - "min": 0, - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "purple", - "value": null - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 11, - "w": 5, - "x": 7, - "y": 9 - }, - "id": 61, - "options": { - "colorMode": "none", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "auto" - }, - "pluginVersion": "8.4.4", - "targets": [ - { - "alias": "$tag_check_name", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "query": "SELECT count(\"check_passed\") FROM \"locust_checks\" WHERE \"check_passed\" = 1 and $timeFilter GROUP BY \"check_name\"\n", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series" - } - ], - "title": "Checks Passed | Total Count", - "type": "stat" - }, - { - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "red", - "mode": "fixed" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "points", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "always", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 0.95 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 11, - "w": 12, - "x": 12, - "y": 9 - }, - "id": 60, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.4.4", - "targets": [ - { - "alias": "FAILED: $tag_check_name", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "query": "SELECT count(\"check_passed\") FROM \"locust_checks\" WHERE (check_passed = 0) and $timeFilter GROUP BY time($__interval), \"check_name\"\n", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series" - } - ], - "title": "Check failures over time", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 20 - }, - "id": 56, - "panels": [], - "title": "HTTP requests", - "type": "row" - }, - { - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "points", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 0, - "pointSize": 4, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 2, - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ms" - }, - "overrides": [] - }, - "gridPos": { - "h": 15, - "w": 18, - "x": 0, - "y": 21 - }, - "id": 43, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "alias": "$tag_name", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "query": "SELECT DISTINCT \"response_time\"\nFROM \"locust_requests\"\nWHERE $timeFilter AND (\"success\"='True') AND (\"request_type\"!='custom') AND (\"request_type\"!='CUSTOM')\nGROUP BY time(1ms), \"name\"", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series" - } - ], - "title": "Request Response Times (ms)", - "type": "timeseries" - }, - { - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "color": "green", - "index": 0, - "text": "0" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 18, - "y": 21 - }, - "id": 64, - "options": { - "colorMode": "none", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.4.4", - "targets": [ - { - "alias": "$tag_exception", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "query": "SELECT count(\"response_time\") FROM \"locust_requests\" WHERE $timeFilter\n", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series" - } - ], - "title": "Total HTTP Requests", - "type": "stat" - }, - { - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "color": "green", - "index": 0, - "text": "0" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "dark-red", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 18, - "y": 25 - }, - "id": 63, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.4.4", - "targets": [ - { - "alias": "$tag_exception", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "query": "SELECT count(\"response_time\") FROM \"locust_requests\" WHERE $timeFilter and \"code\"=~/[45]\\d\\d/\n", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series" - } - ], - "title": "HTTP Errors", - "type": "stat" - }, - { - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 4, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 2, - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 24, - "x": 0, - "y": 36 - }, - "id": 68, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "alias": "user count", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "query": "SELECT \"user_count\"\nFROM \"locust_requests\"\nWHERE $timeFilter", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series" - } - ], - "title": "Number of users", - "type": "timeseries" - }, - { - "datasource": { - "type": "influxdb", - "uid": "$DB_SOURCE" - }, - "description": "Requests Per Second over time", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 4, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "always", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "links": [], - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 46 - }, - "id": 26, - "links": [], - "options": { - "legend": { - "calcs": [ - "mean" - ], - "displayMode": "table", - "placement": "right" - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "8.4.4", - "targets": [ - { - "alias": "RPS", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "null" - ], - "type": "fill" - } - ], - "orderByTime": "ASC", - "policy": "default", - "query": "SELECT c\nFROM (\nSELECT count(response_time) as c \nFROM \"locust_requests\"\nWHERE $timeFilter\nGROUP BY time(1s))", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "value" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - } - ], - "title": "RPS (Requests per Second)", - "transformations": [], - "type": "timeseries" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "influxdb", - "uid": "$DB_SOURCE" - }, - "description": "Number of requests per second over time.", - "fieldConfig": { - "defaults": { - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 46 - }, - "hiddenSeries": false, - "id": 25, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "hideEmpty": true, - "hideZero": true, - "max": false, - "min": false, - "rightSide": true, - "show": false, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "8.4.4", - "pointradius": 2, - "points": true, - "renderer": "flot", - "seriesOverrides": [ - { - "$$hashKey": "object:65" - } - ], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "$tag_name", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "null" - ], - "type": "fill" - } - ], - "orderByTime": "ASC", - "policy": "default", - "query": "SELECT count(\"response_time\")\nFROM \"locust_requests\"\nWHERE $timeFilter and \"code\"=~/[45]\\d\\d/\nGROUP BY time($__interval), \"name\", \"code\"", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "value" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - } - ], - "thresholds": [], - "timeRegions": [], - "title": "HTTP errors over time", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "transformations": [], - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:4502", - "decimals": 0, - "format": "none", - "label": "", - "logBase": 1, - "min": "1", - "show": true - }, - { - "$$hashKey": "object:4503", - "format": "short", - "logBase": 1, - "min": "0", - "show": false - } - ], - "yaxis": { - "align": false - } - }, - { - "columns": [], - "datasource": { - "type": "influxdb", - "uid": "$DB_SOURCE" - }, - "fontSize": "100%", - "gridPos": { - "h": 9, - "w": 24, - "x": 0, - "y": 54 - }, - "id": 29, - "pageSize": 10, - "scroll": true, - "showHeader": true, - "sort": { - "col": 2, - "desc": true - }, - "styles": [ - { - "alias": "Time", - "align": "auto", - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "pattern": "Time", - "type": "hidden" - }, - { - "alias": "Error", - "align": "auto", - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "mappingType": 1, - "pattern": "Metric", - "preserveFormat": false, - "sanitize": true, - "thresholds": [], - "type": "string", - "unit": "short" - }, - { - "alias": "Total", - "align": "auto", - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 0, - "mappingType": 1, - "pattern": "Value", - "thresholds": [], - "type": "number", - "unit": "none" - } - ], - "targets": [ - { - "alias": "$tag_request_type $tag_name: $tag_exception", - "datasource": { - "type": "influxdb", - "uid": "uzwl2Msnk" - }, - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "null" - ], - "type": "fill" - } - ], - "orderByTime": "ASC", - "policy": "default", - "query": "SELECT count(\"counter\")\nFROM \"locust_requests\"\nWHERE $timeFilter and \"code\"=~/[45]\\d\\d/\nGROUP BY \"request_type\", \"name\", \"exception\"\nLIMIT 200", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "value" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - } - ], - "title": "Request Errors", - "transform": "timeseries_to_rows", - "type": "table-old" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 63 - }, - "id": 54, - "panels": [], - "title": "Locust events and errors", - "type": "row" - }, - { - "columns": [], - "datasource": { - "uid": "$DB_SOURCE" - }, - "description": "Hatching Events", - "fontSize": "100%", - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 64 - }, - "id": 24, - "interval": "", - "pageSize": 10, - "scroll": true, - "showHeader": true, - "sort": { - "col": 2, - "desc": true - }, - "styles": [ - { - "alias": "", - "align": "auto", - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "mappingType": 1, - "pattern": "Time", - "thresholds": [], - "type": "date", - "unit": "short" - }, - { - "alias": "Event", - "align": "auto", - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "mappingType": 1, - "pattern": "locust_events.event", - "thresholds": [], - "type": "number", - "unit": "short" - }, - { - "alias": "Node ID", - "align": "auto", - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "mappingType": 1, - "pattern": "locust_events.node_id", - "thresholds": [], - "type": "number", - "unit": "short" - }, - { - "alias": "User Count", - "align": "auto", - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "mappingType": 1, - "pattern": "locust_events.user_count", - "thresholds": [], - "type": "number", - "unit": "short" - } - ], - "targets": [ - { - "alias": "", - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "null" - ], - "type": "fill" - } - ], - "orderByTime": "ASC", - "policy": "default", - "query": "SELECT \"time\", \"event\", \"node_id\", \"user_count\"\nFROM \"locust_events\" \nWHERE $timeFilter\nAND event <> 'papaya'", - "rawQuery": true, - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "value" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - } - ], - "title": "Hatching Events", - "transform": "timeseries_to_columns", - "type": "table-old" - }, - { - "columns": [], - "datasource": { - "uid": "$DB_SOURCE" - }, - "fontSize": "100%", - "gridPos": { - "h": 9, - "w": 24, - "x": 0, - "y": 72 - }, - "id": 22, - "pageSize": 10, - "scroll": true, - "showHeader": true, - "sort": { - "col": 2, - "desc": true - }, - "styles": [ - { - "alias": "Time", - "align": "auto", - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "pattern": "Time", - "type": "hidden" - }, - { - "alias": "Error", - "align": "auto", - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "decimals": 2, - "link": false, - "pattern": "exception_tag", - "preserveFormat": true, - "sanitize": true, - "thresholds": [], - "type": "string", - "unit": "short" - }, - { - "alias": "Total", - "align": "auto", - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 0, - "mappingType": 1, - "pattern": "count", - "thresholds": [], - "type": "number", - "unit": "none" - } - ], - "targets": [ - { - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "null" - ], - "type": "fill" - } - ], - "orderByTime": "ASC", - "policy": "default", - "query": "SELECT count(\"exception\")\nFROM \"locust_exceptions\" \nWHERE $timeFilter\nGROUP BY \"exception_tag\"", - "rawQuery": true, - "refId": "A", - "resultFormat": "table", - "select": [ - [ - { - "params": [ - "value" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - } - ], - "title": "Locust Errors", - "transform": "table", - "type": "table-old" - } - ], - "refresh": "", - "schemaVersion": 35, - "style": "dark", - "tags": [], - "templating": { - "list": [ - { - "current": { - "selected": false, - "text": "InfluxDB locust", - "value": "InfluxDB locust" - }, - "hide": 1, - "includeAll": false, - "label": "DB_SOURCE", - "multi": false, - "name": "DB_SOURCE", - "options": [], - "query": "influxdb", - "queryValue": "", - "refresh": 1, - "regex": "/.*locust*/", - "skipUrlSync": false, - "type": "datasource" - } - ] - }, - "time": { - "from": "now-30m", - "to": "now" - }, - "timepicker": { - "refresh_intervals": [ - "2s", - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ] - }, - "timezone": "browser", - "title": "Grasshopper | Example Dashboard", - "uid": "9u1ewkaVz", - "version": 3, - "weekStart": "" -} \ No newline at end of file diff --git a/example/observability_infrastructure/docker-compose.yml b/example/observability_infrastructure/docker-compose.yml index 7980721..d2cb814 100644 --- a/example/observability_infrastructure/docker-compose.yml +++ b/example/observability_infrastructure/docker-compose.yml @@ -14,6 +14,7 @@ services: ports: - "80:3000" - "443:3000" + - "3000:3000" environment: GF_SERVER_ROOT_URL: "%(protocol)s://%(domain)s:%(http_port)s/" GF_AUTH_ANONYMOUS_ENABLED: "true" diff --git a/example/observability_infrastructure/provisioning/dashboards/example_grafana_dashboard.json b/example/observability_infrastructure/provisioning/dashboards/example_grafana_dashboard.json index bcaa142..a5b4107 100644 --- a/example/observability_infrastructure/provisioning/dashboards/example_grafana_dashboard.json +++ b/example/observability_infrastructure/provisioning/dashboards/example_grafana_dashboard.json @@ -4,7 +4,10 @@ { "$$hashKey": "object:10", "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -22,13 +25,15 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, - "id": 10, - "iteration": 1678226744476, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "influxdb", + "uid": "influxdb_locust" + }, "gridPos": { "h": 1, "w": 24, @@ -37,13 +42,23 @@ }, "id": 58, "panels": [], + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "influxdb_locust" + }, + "refId": "A" + } + ], "title": "Custom Trends and Checks", "type": "row" }, { "datasource": { + "name": "influxdb", "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "fieldConfig": { "defaults": { @@ -51,6 +66,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -62,6 +80,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 4, @@ -89,7 +108,8 @@ } ] }, - "unit": "ms" + "unit": "ms", + "unitScale": true }, "overrides": [] }, @@ -108,7 +128,8 @@ "max" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { "mode": "single", @@ -121,7 +142,7 @@ "alias": " $tag_name", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "query": "SELECT DISTINCT \"response_time\"\nFROM \"locust_requests\"\nWHERE $timeFilter and \"request_type\"='CUSTOM'\nGROUP BY \"name\"", "rawQuery": true, @@ -135,7 +156,7 @@ { "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "fieldConfig": { "defaults": { @@ -162,7 +183,8 @@ } ] }, - "unit": "percentunit" + "unit": "percentunit", + "unitScale": true }, "overrides": [] }, @@ -175,6 +197,10 @@ "id": 59, "options": { "displayMode": "basic", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ @@ -184,15 +210,17 @@ "values": false }, "showUnfilled": true, - "text": {} + "sizing": "auto", + "text": {}, + "valueMode": "color" }, - "pluginVersion": "8.4.4", + "pluginVersion": "10.3.1", "targets": [ { "alias": "$tag_check_name", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "query": "SELECT mean(\"check_passed\") FROM \"locust_checks\" WHERE $timeFilter GROUP BY \"check_name\"\n", "rawQuery": true, @@ -206,7 +234,7 @@ { "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "fieldConfig": { "defaults": { @@ -236,7 +264,8 @@ } ] }, - "unit": "none" + "unit": "none", + "unitScale": true }, "overrides": [] }, @@ -257,16 +286,18 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.4.4", + "pluginVersion": "10.3.1", "targets": [ { "alias": "$tag_check_name", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "query": "SELECT count(\"check_passed\") FROM \"locust_checks\" WHERE \"check_passed\" = 1 and $timeFilter GROUP BY \"check_name\"\n", "rawQuery": true, @@ -280,7 +311,7 @@ { "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "fieldConfig": { "defaults": { @@ -289,6 +320,9 @@ "mode": "fixed" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -300,6 +334,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -333,7 +368,8 @@ } ] }, - "unit": "none" + "unit": "none", + "unitScale": true }, "overrides": [] }, @@ -348,7 +384,8 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -361,7 +398,7 @@ "alias": "FAILED: $tag_check_name", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "query": "SELECT count(\"check_passed\") FROM \"locust_checks\" WHERE (check_passed = 0) and $timeFilter GROUP BY time($__interval), \"check_name\"\n", "rawQuery": true, @@ -374,6 +411,10 @@ }, { "collapsed": false, + "datasource": { + "type": "influxdb", + "uid": "influxdb_locust" + }, "gridPos": { "h": 1, "w": 24, @@ -382,13 +423,22 @@ }, "id": 56, "panels": [], + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "influxdb_locust" + }, + "refId": "A" + } + ], "title": "HTTP requests", "type": "row" }, { "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "fieldConfig": { "defaults": { @@ -396,6 +446,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -407,6 +460,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -442,7 +496,8 @@ } ] }, - "unit": "ms" + "unit": "ms", + "unitScale": true }, "overrides": [] }, @@ -462,6 +517,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Mean", "sortDesc": true }, @@ -475,7 +531,7 @@ "alias": "$tag_name", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "query": "SELECT DISTINCT \"response_time\"\nFROM \"locust_requests\"\nWHERE $timeFilter AND (\"success\"='True') AND (\"request_type\"!='custom') AND (\"request_type\"!='CUSTOM')\nGROUP BY time(1ms), \"name\"", "rawQuery": true, @@ -489,7 +545,7 @@ { "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "description": "", "fieldConfig": { @@ -518,7 +574,8 @@ "value": null } ] - } + }, + "unitScale": true }, "overrides": [] }, @@ -541,15 +598,17 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.4.4", + "pluginVersion": "10.3.1", "targets": [ { "alias": "$tag_exception", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "query": "SELECT count(\"response_time\") FROM \"locust_requests\" WHERE $timeFilter\n", "rawQuery": true, @@ -563,7 +622,7 @@ { "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "fieldConfig": { "defaults": { @@ -587,8 +646,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "dark-red", @@ -626,7 +684,7 @@ "alias": "$tag_exception", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "query": "SELECT count(\"response_time\") FROM \"locust_requests\" WHERE $timeFilter and \"code\"=~/[45]\\d\\d/\n", "rawQuery": true, @@ -640,7 +698,7 @@ { "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "fieldConfig": { "defaults": { @@ -685,8 +743,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -714,6 +771,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Mean", "sortDesc": true }, @@ -727,7 +785,7 @@ "alias": "user count", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "query": "SELECT \"user_count\"\nFROM \"locust_requests\"\nWHERE $timeFilter", "rawQuery": true, @@ -741,7 +799,7 @@ { "datasource": { "type": "influxdb", - "uid": "$DB_SOURCE" + "uid": "influxdb_locust" }, "description": "Requests Per Second over time", "fieldConfig": { @@ -783,8 +841,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -810,7 +867,8 @@ "mean" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { "mode": "multi", @@ -823,7 +881,7 @@ "alias": "RPS", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "groupBy": [ { @@ -873,7 +931,7 @@ "dashes": false, "datasource": { "type": "influxdb", - "uid": "$DB_SOURCE" + "uid": "influxdb_locust" }, "description": "Number of requests per second over time.", "fieldConfig": { @@ -929,7 +987,7 @@ "alias": "$tag_name", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "groupBy": [ { @@ -1009,7 +1067,7 @@ "columns": [], "datasource": { "type": "influxdb", - "uid": "$DB_SOURCE" + "uid": "influxdb_locust" }, "fontSize": "100%", "gridPos": { @@ -1074,7 +1132,7 @@ "alias": "$tag_request_type $tag_name: $tag_exception", "datasource": { "type": "influxdb", - "uid": "uzwl2Msnk" + "uid": "influxdb_locust" }, "groupBy": [ { @@ -1119,6 +1177,10 @@ }, { "collapsed": false, + "datasource": { + "type": "influxdb", + "uid": "influxdb_locust" + }, "gridPos": { "h": 1, "w": 24, @@ -1127,13 +1189,22 @@ }, "id": 54, "panels": [], + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "influxdb_locust" + }, + "refId": "A" + } + ], "title": "Locust events and errors", "type": "row" }, { "columns": [], "datasource": { - "uid": "$DB_SOURCE" + "uid": "influxdb_locust" }, "description": "Hatching Events", "fontSize": "100%", @@ -1221,6 +1292,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "influxdb_locust" + }, "groupBy": [ { "params": [ @@ -1265,7 +1339,7 @@ { "columns": [], "datasource": { - "uid": "$DB_SOURCE" + "uid": "influxdb_locust" }, "fontSize": "100%", "gridPos": { @@ -1326,6 +1400,9 @@ ], "targets": [ { + "datasource": { + "uid": "influxdb_locust" + }, "groupBy": [ { "params": [ @@ -1369,31 +1446,10 @@ } ], "refresh": "", - "schemaVersion": 35, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { - "list": [ - { - "current": { - "selected": false, - "text": "InfluxDB locust", - "value": "InfluxDB locust" - }, - "hide": 1, - "includeAll": false, - "label": "DB_SOURCE", - "multi": false, - "name": "DB_SOURCE", - "options": [], - "query": "influxdb", - "queryValue": "", - "refresh": 1, - "regex": "/.*locust*/", - "skipUrlSync": false, - "type": "datasource" - } - ] + "list": [] }, "time": { "from": "now-30m", diff --git a/example/observability_infrastructure/provisioning/datasources/datasources.yaml b/example/observability_infrastructure/provisioning/datasources/datasources.yaml index 3b86031..2322de7 100644 --- a/example/observability_infrastructure/provisioning/datasources/datasources.yaml +++ b/example/observability_infrastructure/provisioning/datasources/datasources.yaml @@ -2,7 +2,8 @@ apiVersion: 1 datasources: - name: influxdb type: influxdb - access: proxy - url: http://localhost:8086 + access: server + url: http://influxdb:8086 database: locust + uid: influxdb_locust isDefault: true \ No newline at end of file