Skip to content

Commit ffa6792

Browse files
committed
PAUSED: Use git resume to continue working. [skip ci]
1 parent 2b0513b commit ffa6792

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

metrics_utility/automation_controller_billing/collectors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def daily_slicing(key, last_gather, **kwargs):
4949
else:
5050
from awx.conf.models import Setting
5151

52+
# FIXME: merge with collector _calculate_collection_interval?
5253
horizon = until - timedelta(days=get_max_gather_period_days())
5354
last_entries = Setting.objects.filter(key='AUTOMATION_ANALYTICS_LAST_ENTRIES').first()
5455
last_entries = json.loads((last_entries.value if last_entries is not None else '') or '{}', object_hook=datetime_hook)
@@ -173,6 +174,7 @@ def _copy_table_aap_2_5_and_above(cursor, query, file):
173174
with cursor.copy(query) as copy:
174175
while data := copy.read():
175176
byte_data = bytes(data)
177+
# byte_data is individual CSV lines here
176178
file.write(byte_data.decode())
177179

178180

metrics_utility/base/collection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,17 @@ def slices(self):
9292
return self.fnc_slicing(self.key, last_gather, full_sync_enabled=True)
9393

9494
if self.fnc_slicing:
95+
# TODO: accepts since=None? or just never used that way?
9596
return self.fnc_slicing(self.key, last_gather, since=since, until=until)
9697

9798
# Start/end of gathering based on settings excluding slices
99+
# FIXME: merge with collector _calculate_collection_interval?
98100
last_entry = max(
99101
self.last_gathered_entry or self.collector.last_gather,
100102
self.collector.gather_until - timedelta(days=get_max_gather_period_days()),
101103
)
102104

105+
## TODO: gather_since OR last_entry is the answer to Final since-until .. except both ^returns too
103106
return [(self.collector.gather_since or last_entry, self.collector.gather_until)]
104107

105108
def ship_immediately(self):

metrics_utility/base/collector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def _calculate_collection_interval(self, since, until):
211211
# `until`, but we want to keep `since` empty if it wasn't passed in because we use that
212212
# case to know whether to use the bookkeeping settings variables to decide the start of
213213
# the interval.
214+
# FIXME: but we also want to log the real since...
214215
horizon = until - _timedelta
215216
if since is not None and since < horizon:
216217
since = horizon

metrics_utility/base/csv_file_splitter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def write(self, s):
5555
"""Writes to file and creates new one if file exceedes threshold"""
5656
if not self.header:
5757
self.header = s[: s.index('\n')]
58+
# this goes over the limit before cycling, but ensures we write at least once, and this is before gz anyway
5859
self.counter += self.currentfile.write(s)
5960
if self.counter >= self.max_file_size:
6061
self.cycle_file()

0 commit comments

Comments
 (0)