diff --git a/ansible/playbooks/setup_redis.yml b/ansible/playbooks/setup_redis.yml index 95b246259..eb74447ae 100644 --- a/ansible/playbooks/setup_redis.yml +++ b/ansible/playbooks/setup_redis.yml @@ -16,5 +16,5 @@ - {role: 'consul-client', tags: 'consul'} - {role: 'node-exporter', tags: ['node-exporter', 'metrics']} - {role: 'redis', tags: 'redis'} - - {role: 'flask_metrics', tags: ['flask-metrics', 'metrics']} + - {role: 'flask_metrics', tags: ['flask-metrics', 'metrics', 'flask_metrics']} - {role: 'monitor', tags: 'monitor'} diff --git a/apps/profile/middleware.py b/apps/profile/middleware.py index cbe14873c..d28d43eaa 100644 --- a/apps/profile/middleware.py +++ b/apps/profile/middleware.py @@ -21,10 +21,9 @@ class LastSeenMiddleware(object): request.path.startswith('/reader/load_feeds') or request.path.startswith('/reader/feeds')) and hasattr(request, 'user') - and request.user.is_authenticated): + and request.user.is_authenticated): hour_ago = datetime.datetime.utcnow() - datetime.timedelta(minutes=60) ip = request.META.get('HTTP_X_FORWARDED_FOR', None) or request.META['REMOTE_ADDR'] - # SUBSCRIBER_EXPIRE = datetime.datetime.utcnow() - datetime.timedelta(days=settings.SUBSCRIBER_EXPIRE) if request.user.profile.last_seen_on < hour_ago: logging.user(request, "~FG~BBRepeat visitor: ~SB%s (%s)" % ( request.user.profile.last_seen_on, ip)) @@ -101,7 +100,8 @@ class DBProfilerMiddleware: self._save_times(self.sql_times_elapsed, 'app_') def _save_times(self, db_times, prefix=""): - if not db_times: return + if not db_times: + return r = redis.Redis(connection_pool=settings.REDIS_STATISTICS_POOL) pipe = r.pipeline() diff --git a/apps/profile/tasks.py b/apps/profile/tasks.py index 787112036..fa5ef594d 100644 --- a/apps/profile/tasks.py +++ b/apps/profile/tasks.py @@ -54,7 +54,7 @@ def CleanupUser(user_id): MActivity.trim(user_id) UserSubscriptionFolders.add_missing_feeds_for_user(user_id) UserSubscriptionFolders.compact_for_user(user_id) - # UserSubscription.refresh_stale_feeds(user_id) + UserSubscription.refresh_stale_feeds(user_id) try: ss = MSocialServices.objects.get(user_id=user_id) diff --git a/docker/grafana/dashboards/newsblur_dashboard.json b/docker/grafana/dashboards/newsblur_dashboard.json index f8dcc8836..6f1ceab32 100644 --- a/docker/grafana/dashboards/newsblur_dashboard.json +++ b/docker/grafana/dashboards/newsblur_dashboard.json @@ -12,11 +12,18 @@ "name": "Annotations & Alerts", "showIn": 0, "tags": [], + "target": { + "limit": 100, + "matchAny": true, + "tags": [], + "type": "dashboard" + }, "type": "dashboard" } ] }, "editable": true, + "fiscalYearStartMonth": 0, "gnetId": null, "graphTooltip": 1, "id": 4, @@ -34,6 +41,7 @@ "url": "" } ], + "liveNow": false, "panels": [ { "collapsed": false, @@ -44,214 +52,6 @@ "x": 0, "y": 0 }, - "id": 68, - "panels": [], - "title": "Elasticsearch", - "type": "row" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 1 - }, - "hiddenSeries": false, - "id": 70, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.7", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "exemplar": true, - "expr": "elasticsearch_indices_docs", - "interval": "", - "legendFormat": "{{ instance }}", - "queryType": "randomWalk", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Elasticsearch # Docs", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:139", - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": "0", - "show": true - }, - { - "$$hashKey": "object:140", - "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", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 1 - }, - "hiddenSeries": false, - "id": 76, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.7", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "exemplar": true, - "expr": "rate(elasticsearch_indices_docs[1d])", - "interval": "", - "legendFormat": "{{ instance }}", - "queryType": "randomWalk", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Elasticsearch # Docs per day", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:139", - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": "0", - "show": true - }, - { - "$$hashKey": "object:140", - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "collapsed": false, - "datasource": null, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 9 - }, "id": 46, "panels": [], "title": "Top Line", @@ -272,10 +72,10 @@ "fill": 1, "fillGradient": 0, "gridPos": { - "h": 7, - "w": 24, + "h": 6, + "w": 8, "x": 0, - "y": 10 + "y": 1 }, "hiddenSeries": false, "id": 22, @@ -296,7 +96,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -385,10 +185,10 @@ "fill": 1, "fillGradient": 0, "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 17 + "h": 6, + "w": 8, + "x": 8, + "y": 1 }, "hiddenSeries": false, "id": 44, @@ -410,7 +210,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -511,10 +311,10 @@ "fill": 1, "fillGradient": 10, "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 25 + "h": 6, + "w": 8, + "x": 16, + "y": 1 }, "hiddenSeries": false, "id": 38, @@ -537,7 +337,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -619,7 +419,7 @@ "h": 1, "w": 24, "x": 0, - "y": 32 + "y": 7 }, "id": 20, "panels": [], @@ -643,10 +443,10 @@ "fill": 10, "fillGradient": 0, "gridPos": { - "h": 9, - "w": 24, + "h": 8, + "w": 12, "x": 0, - "y": 33 + "y": 8 }, "hiddenSeries": false, "id": 2, @@ -669,7 +469,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -749,10 +549,10 @@ "fill": 0, "fillGradient": 0, "gridPos": { - "h": 9, - "w": 24, - "x": 0, - "y": 42 + "h": 8, + "w": 12, + "x": 12, + "y": 8 }, "hiddenSeries": false, "id": 6, @@ -766,6 +566,8 @@ "min": false, "rightSide": true, "show": true, + "sort": "avg", + "sortDesc": true, "total": false, "values": true }, @@ -776,7 +578,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -846,7 +648,7 @@ "h": 1, "w": 24, "x": 0, - "y": 51 + "y": 16 }, "id": 4, "panels": [], @@ -880,10 +682,10 @@ "overrides": [] }, "gridPos": { - "h": 22, + "h": 21, "w": 24, "x": 0, - "y": 52 + "y": 17 }, "id": 10, "options": { @@ -901,7 +703,7 @@ "text": {}, "textMode": "auto" }, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "targets": [ { "exemplar": true, @@ -937,7 +739,7 @@ "h": 7, "w": 24, "x": 0, - "y": 74 + "y": 38 }, "hiddenSeries": false, "id": 48, @@ -959,7 +761,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1028,7 +830,7 @@ "h": 1, "w": 24, "x": 0, - "y": 81 + "y": 45 }, "id": 42, "panels": [], @@ -1041,17 +843,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 9, "w": 24, "x": 0, - "y": 82 + "y": 46 }, "hiddenSeries": false, "id": 33, @@ -1073,7 +871,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1116,7 +914,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1154,7 +952,7 @@ "h": 8, "w": 24, "x": 0, - "y": 91 + "y": 55 }, "hiddenSeries": false, "id": 30, @@ -1178,7 +976,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1349,7 +1147,7 @@ "h": 8, "w": 24, "x": 0, - "y": 99 + "y": 63 }, "hiddenSeries": false, "id": 32, @@ -1374,7 +1172,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1442,17 +1240,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 24, "x": 0, - "y": 107 + "y": 71 }, "hiddenSeries": false, "id": 28, @@ -1474,7 +1268,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1559,17 +1353,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 114 + "y": 78 }, "hiddenSeries": false, "id": 12, @@ -1589,7 +1379,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1657,17 +1447,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 114 + "y": 78 }, "hiddenSeries": false, "id": 26, @@ -1687,7 +1473,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1752,17 +1538,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 122 + "y": 86 }, "hiddenSeries": false, "id": 14, @@ -1782,7 +1564,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1848,7 +1630,7 @@ "h": 1, "w": 24, "x": 0, - "y": 130 + "y": 94 }, "id": 50, "panels": [], @@ -1861,17 +1643,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 24, "x": 0, - "y": 131 + "y": 95 }, "hiddenSeries": false, "id": 56, @@ -1893,7 +1671,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -1960,17 +1738,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 139 + "y": 103 }, "hiddenSeries": false, "id": 52, @@ -1990,7 +1764,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2057,17 +1831,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 139 + "y": 103 }, "hiddenSeries": false, "id": 54, @@ -2087,7 +1857,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2154,17 +1924,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 147 + "y": 111 }, "hiddenSeries": false, "id": 58, @@ -2184,7 +1950,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2251,17 +2017,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 147 + "y": 111 }, "hiddenSeries": false, "id": 60, @@ -2281,7 +2043,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2349,7 +2111,7 @@ "h": 1, "w": 24, "x": 0, - "y": 155 + "y": 119 }, "id": 62, "panels": [], @@ -2362,17 +2124,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 24, "x": 0, - "y": 156 + "y": 120 }, "hiddenSeries": false, "id": 75, @@ -2394,7 +2152,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2461,17 +2219,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 24, "x": 0, - "y": 164 + "y": 128 }, "hiddenSeries": false, "id": 66, @@ -2492,7 +2246,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2626,17 +2380,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 24, "x": 0, - "y": 172 + "y": 136 }, "hiddenSeries": false, "id": 71, @@ -2657,7 +2407,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2776,17 +2526,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 24, "x": 0, - "y": 180 + "y": 144 }, "hiddenSeries": false, "id": 72, @@ -2807,7 +2553,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2912,17 +2658,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 24, "x": 0, - "y": 188 + "y": 152 }, "hiddenSeries": false, "id": 73, @@ -2943,7 +2685,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -3016,17 +2758,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 24, "x": 0, - "y": 195 + "y": 159 }, "hiddenSeries": false, "id": 78, @@ -3046,7 +2784,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -3113,17 +2851,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 203 + "y": 167 }, "hiddenSeries": false, "id": 80, @@ -3143,7 +2877,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -3162,7 +2896,9 @@ } ], "thresholds": [], + "timeFrom": null, "timeRegions": [], + "timeShift": null, "title": "Redis Used Memory", "tooltip": { "shared": true, @@ -3208,17 +2944,13 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 203 + "y": 167 }, "hiddenSeries": false, "id": 64, @@ -3238,7 +2970,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -3300,400 +3032,583 @@ } }, { - "collapsed": true, + "collapsed": false, "datasource": null, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 211 + "y": 175 }, - "id": 16, - "panels": [ + "id": 68, + "panels": [], + "title": "Elasticsearch", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 176 + }, + "hiddenSeries": false, + "id": 70, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.6", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 118 - }, - "hiddenSeries": false, - "id": 18, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.7", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "exemplar": true, - "expr": "feeds", - "interval": "", - "legendFormat": "{{category}}", - "queryType": "randomWalk", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Feeds & Subscriptions", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "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", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 118 - }, - "hiddenSeries": false, - "id": 24, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.7", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "exemplar": true, - "expr": "stories", - "interval": "", - "legendFormat": "{{ category }}", - "queryType": "randomWalk", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "NewsBlur Stories", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "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", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 126 - }, - "hiddenSeries": false, - "id": 35, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.7", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "exemplar": true, - "expr": "users", - "interval": "", - "legendFormat": "{{ category }}", - "queryType": "randomWalk", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "NewsBlur Users", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "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", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 126 - }, - "hiddenSeries": false, - "id": 8, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.7", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "exemplar": true, - "expr": "classifiers", - "interval": "", - "legendFormat": "{{classifier}}", - "queryType": "randomWalk", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "NewsBlur Classifiers", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "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 - } + "exemplar": true, + "expr": "elasticsearch_indices_docs", + "interval": "", + "legendFormat": "{{ instance }}", + "queryType": "randomWalk", + "refId": "A" } ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Elasticsearch # Docs", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:139", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:140", + "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, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 176 + }, + "hiddenSeries": false, + "id": 76, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.6", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "rate(elasticsearch_indices_docs[1d])", + "interval": "", + "legendFormat": "{{ instance }}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Elasticsearch # Docs per day", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:139", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:140", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 184 + }, + "id": 16, + "panels": [], "title": "NewsBlur Stats", "type": "row" }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 185 + }, + "hiddenSeries": false, + "id": 18, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.6", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "feeds", + "interval": "", + "legendFormat": "{{category}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Feeds & Subscriptions", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "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, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 185 + }, + "hiddenSeries": false, + "id": 24, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.6", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "stories", + "interval": "", + "legendFormat": "{{ category }}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NewsBlur Stories", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "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, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 193 + }, + "hiddenSeries": false, + "id": 35, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.6", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "users", + "interval": "", + "legendFormat": "{{ category }}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NewsBlur Users", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "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, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 193 + }, + "hiddenSeries": false, + "id": 8, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.6", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "classifiers", + "interval": "", + "legendFormat": "{{classifier}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NewsBlur Classifiers", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "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 + } + }, { "collapsed": true, "datasource": null, @@ -3701,7 +3616,7 @@ "h": 1, "w": 24, "x": 0, - "y": 212 + "y": 201 }, "id": 40, "panels": [ @@ -3774,7 +3689,7 @@ } ], "refresh": "1m", - "schemaVersion": 27, + "schemaVersion": 32, "style": "dark", "tags": [], "templating": { @@ -3788,5 +3703,5 @@ "timezone": "", "title": "NewsBlur", "uid": "T86VjXrG2", - "version": 48 + "version": 54 } diff --git a/docker/grafana/dashboards/redis_dashboard.json b/docker/grafana/dashboards/redis_dashboard.json index a3789ec6f..11ff01860 100644 --- a/docker/grafana/dashboards/redis_dashboard.json +++ b/docker/grafana/dashboards/redis_dashboard.json @@ -8,16 +8,24 @@ "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, "gnetId": null, "graphTooltip": 0, "id": 8, - "iteration": 1638808327674, + "iteration": 1638880390648, "links": [], + "liveNow": false, "panels": [ { "aliasColors": {}, @@ -25,10 +33,6 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { @@ -55,7 +59,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -98,7 +102,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -122,10 +126,6 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { @@ -152,7 +152,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -195,7 +195,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -219,10 +219,6 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { @@ -249,7 +245,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -287,14 +283,16 @@ }, "yaxes": [ { + "$$hashKey": "object:176", "format": "short", "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { + "$$hashKey": "object:177", "format": "short", "label": null, "logBase": 1, @@ -314,10 +312,6 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { @@ -344,7 +338,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -382,14 +376,16 @@ }, "yaxes": [ { + "$$hashKey": "object:406", "format": "short", "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { + "$$hashKey": "object:407", "format": "short", "label": null, "logBase": 1, @@ -409,10 +405,7 @@ "dashLength": 10, "dashes": false, "datasource": "Prometheus", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, + "description": "", "fill": 1, "fillGradient": 0, "gridPos": { @@ -439,7 +432,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -450,7 +443,7 @@ "targets": [ { "exemplar": true, - "expr": "redis_commands{instance=\"$instance\"}", + "expr": "rate(redis_commands{instance=\"$instance\"}[1m])", "interval": "", "legendFormat": "Total Commands Processed", "queryType": "randomWalk", @@ -461,7 +454,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Redis Commands", + "title": "Redis Commands per minute", "tooltip": { "shared": true, "sort": 0, @@ -477,14 +470,16 @@ }, "yaxes": [ { + "$$hashKey": "object:562", "format": "short", "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { + "$$hashKey": "object:563", "format": "short", "label": null, "logBase": 1, @@ -505,10 +500,6 @@ "dashes": false, "datasource": "Prometheus", "description": "", - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { @@ -535,7 +526,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.5.7", + "pluginVersion": "8.2.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -595,7 +586,7 @@ } } ], - "schemaVersion": 27, + "schemaVersion": 32, "style": "dark", "tags": [], "templating": { @@ -603,10 +594,9 @@ { "allValue": null, "current": { - "isNone": true, "selected": false, - "text": "None", - "value": "" + "text": "db-redis-pubsub", + "value": "db-redis-pubsub" }, "datasource": "Prometheus", "definition": "label_values(redis_active_connections, instance)", @@ -627,7 +617,6 @@ "skipUrlSync": false, "sort": 0, "tagValuesQuery": "", - "tags": [], "tagsQuery": "", "type": "query", "useTags": false @@ -642,5 +631,5 @@ "timezone": "", "title": "Redis", "uid": "7IvPZkDnk", - "version": 1 + "version": 3 } diff --git a/flask_metrics/flask_metrics_redis.py b/flask_metrics/flask_metrics_redis.py index 6c3999f22..fbaa5cab2 100644 --- a/flask_metrics/flask_metrics_redis.py +++ b/flask_metrics/flask_metrics_redis.py @@ -35,7 +35,7 @@ class RedisMetric(object): if not settings.DOCKERBUILD and settings.SERVER_NAME != instance: continue self.host = redis_config['host'] - self.port = redis_config['port'] + self.port = redis_config.get('port', settings.REDIS_PORT) stats = self.get_info() yield instance, stats diff --git a/terraform/digitalocean.tf b/terraform/digitalocean.tf index c4d0882ae..b26f0f48f 100644 --- a/terraform/digitalocean.tf +++ b/terraform/digitalocean.tf @@ -2,7 +2,7 @@ terraform { required_providers { digitalocean = { source = "digitalocean/digitalocean" - version = "1.22.2" + version = "~> 2.0" } }