Skip to content

Commit

Permalink
{Telemetry} reduce default pushing interval to 1h (Azure#26509)
Browse files Browse the repository at this point in the history
  • Loading branch information
evelyn-ys authored May 30, 2023
1 parent d88b020 commit ff6fd9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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=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
threshold = config.getint('telemetry', 'push_interval_in_hours', fallback=1)
# the threshold for push telemetry can't be less than 1 hour, default value is 1 hour
return threshold if threshold >= 1 else 1

def _read_file(self, path):
""" Read content of a telemetry cache file and parse them into records. """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=2)
last_send = datetime.datetime.now() - datetime.timedelta(minutes=20)
collection = RecordsCollection(last_send, self.work_dir)
collection.snapshot_and_read()

# the threshold for pushing 'cache' file is 6, so 'cache' file should not be moved
# the threshold for pushing 'cache' file is 1 hour, 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]))
Expand Down

0 comments on commit ff6fd9f

Please sign in to comment.