Skip to content

Commit 925d99d

Browse files
committed
Fix timestamp bug in file reporter
The file reporter writes the profile into a local file, current timestamp is added in the file name, unfortunately that timestamp was set at load time because of the default argument so each reports would always go into the same file. This small fix will ensure that different files will be created and the file name will get proper timestamp.
1 parent d275c23 commit 925d99d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

codeguru_profiler_agent/file_reporter/file_reporter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def refresh_configuration(self):
3535
"""
3636
pass
3737

38-
def report(self, profile, agent_metadata=None, timestamp=datetime.datetime.now()):
38+
def report(self, profile, agent_metadata=None, timestamp=None):
39+
if timestamp is None:
40+
timestamp = datetime.datetime.now()
3941
output_filename = self._output_filename_for(timestamp)
4042

4143
logger.info("Writing profile to '{}'".format(output_filename))

0 commit comments

Comments
 (0)