From 6ab72385dcba8244e9f199ee2ae82a873118bc65 2016-10-12 14:57:44 From: Marcin Lulek Date: 2016-10-12 14:57:44 Subject: [PATCH] tasks: include hours in stat keys --- diff --git a/backend/src/appenlight/celery/tasks.py b/backend/src/appenlight/celery/tasks.py index 3da7927..db68225 100644 --- a/backend/src/appenlight/celery/tasks.py +++ b/backend/src/appenlight/celery/tasks.py @@ -203,8 +203,8 @@ def add_reports(resource_id, request_params, dataset, **kwargs): redis_pipeline.incr(key, total_reports) redis_pipeline.expire(key, 3600 * 24 * 7) redis_pipeline.sadd( - REDIS_KEYS['apps_that_got_new_data_per_hour'], - resource_id, current_time.replace(minute=0)) + REDIS_KEYS['apps_that_got_new_data_per_hour'].format( + current_time.replace(minute=0)), resource_id) redis_pipeline.execute() add_reports_es(es_report_group_docs, es_report_docs) @@ -322,8 +322,8 @@ def add_logs(resource_id, request_params, dataset, **kwargs): redis_pipeline.incr(key, total_logs) redis_pipeline.expire(key, 3600 * 24 * 7) redis_pipeline.sadd( - REDIS_KEYS['apps_that_got_new_data_per_hour'], - resource_id, current_time.replace(minute=0)) + REDIS_KEYS['apps_that_got_new_data_per_hour'].format( + current_time.replace(minute=0)), resource_id) redis_pipeline.execute() add_logs_es(es_docs) return True @@ -380,8 +380,8 @@ def add_metrics(resource_id, request_params, dataset, proto_version): redis_pipeline.incr(key, len(rows)) redis_pipeline.expire(key, 3600 * 24 * 7) redis_pipeline.sadd( - REDIS_KEYS['apps_that_got_new_data_per_hour'], - resource_id, current_time.replace(minute=0)) + REDIS_KEYS['apps_that_got_new_data_per_hour'].format( + current_time.replace(minute=0)), resource_id) redis_pipeline.execute() add_metrics_es(es_docs) return True diff --git a/backend/src/appenlight/lib/redis_keys.py b/backend/src/appenlight/lib/redis_keys.py index 9adb537..e7596f0 100644 --- a/backend/src/appenlight/lib/redis_keys.py +++ b/backend/src/appenlight/lib/redis_keys.py @@ -53,7 +53,7 @@ REDIS_KEYS = { 'per_application_metrics_rate_limit': BASE.format( 'per_application_metrics_rate_limit:{}:{}'), }, - 'apps_that_got_new_data_per_hour': BASE.format('apps_that_got_new_data_per_hour'), + 'apps_that_got_new_data_per_hour': BASE.format('apps_that_got_new_data_per_hour:{}'), 'apps_that_had_reports': BASE.format('apps_that_had_reports'), 'apps_that_had_error_reports': BASE.format('apps_that_had_error_reports'), 'apps_that_had_reports_alerting': BASE.format(