From 998db48c5920d0522afe37c18da750b729b03474 Mon Sep 17 00:00:00 2001 From: evelyn-ys Date: Thu, 6 Apr 2023 13:49:12 +0800 Subject: [PATCH 1/2] telemetry default push interval changed from 24h to 6h --- .../azure/cli/telemetry/components/records_collection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure-cli-telemetry/azure/cli/telemetry/components/records_collection.py b/src/azure-cli-telemetry/azure/cli/telemetry/components/records_collection.py index a1055aeb41a..e64bedd70f1 100644 --- a/src/azure-cli-telemetry/azure/cli/telemetry/components/records_collection.py +++ b/src/azure-cli-telemetry/azure/cli/telemetry/components/records_collection.py @@ -74,9 +74,9 @@ def snapshot_and_read(self): def _get_push_interval_config(self): config = CLIConfig(config_dir=self._config_dir) - threshold = config.getint('telemetry', 'push_interval_in_hours', fallback=24) - # the threshold for push telemetry can't be less than 1 hour, default value is 24 hours - return threshold if threshold >= 1 else 24 + threshold = config.getint('telemetry', 'push_interval_in_hours', fallback=6) + # the threshold for push telemetry can't be less than 1 hour, default value is 6 hours + return threshold if threshold >= 1 else 6 def _read_file(self, path): """ Read content of a telemetry cache file and parse them into records. """ From bce1b9a0a89bc9dd48f91ca53db05fca8832c871 Mon Sep 17 00:00:00 2001 From: Yishi Wang Date: Fri, 7 Apr 2023 10:33:15 +0800 Subject: [PATCH 2/2] fix test --- .../azure/cli/telemetry/tests/test_records_collection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli-telemetry/azure/cli/telemetry/tests/test_records_collection.py b/src/azure-cli-telemetry/azure/cli/telemetry/tests/test_records_collection.py index b1415672f67..2fe289c7358 100644 --- a/src/azure-cli-telemetry/azure/cli/telemetry/tests/test_records_collection.py +++ b/src/azure-cli-telemetry/azure/cli/telemetry/tests/test_records_collection.py @@ -42,11 +42,11 @@ def test_create_records_collection(self): self.assertEqual(1758, len([r for r in collection])) def test_create_records_collection_with_last_send(self): - last_send = datetime.datetime.now() - datetime.timedelta(hours=6) + last_send = datetime.datetime.now() - datetime.timedelta(hours=2) collection = RecordsCollection(last_send, self.work_dir) collection.snapshot_and_read() - # the threshold for pushing 'cache' file is 24, so 'cache' file should not be moved + # the threshold for pushing 'cache' file is 6, so 'cache' file should not be moved self.assert_cache_files_count(1) # no new records since last_send self.assertEqual(0, len([r for r in collection]))