Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect turbinia processor telemetry #861

Merged
merged 6 commits into from
May 15, 2024
Merged

Conversation

jleaniz
Copy link
Collaborator

@jleaniz jleaniz commented May 14, 2024

No description provided.

@tomchop tomchop marked this pull request as ready for review May 15, 2024 11:17
@@ -17,6 +18,11 @@
TOKEN_REGEX = re.compile(r'\@([\w_]+)')


def CalculateRunTime(time_start: float) -> float:
"""Calculates a time delta used for runtime calulcations."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given all the operations happening, it would be nice to specify which units we're taking in and returnin (e.g. seconds, milliseconds, etc.)


total_time = utils.CalculateRunTime(time_start)
TELEMETRY.LogTelemetry(
'total_time', str(total_time), 'core', self.recipe.get('name', 'no_name'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue that the key here should rather be something like total_time_<module_name> so that we can differentiate the entries per module.

Alternatively - you can also change the 'core' parameter to be core-<module_name>.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment for the changes in L365

Comment on lines 267 to 282
# Store profiler telemetry
telemetry_entry = {}
for profiler_entry in (
self.profiler.getstats()): # pytype: disable=attribute-error
# pytype: disable=attribute-error
if isinstance(profiler_entry.code, str):
method_name = profiler_entry.code
else:
method_name = profiler_entry.code.co_name
if method_name in self.profiler_methods:
telemetry_entry[method_name] = (
f'callcount: {str(profiler_entry.callcount)}, '
f'tottime :{str(round(profiler_entry.totaltime * 1000, 10))},'
f'inlinetime: {str(round(profiler_entry.inlinetime * 1000, 10))}'
)
self.LogTelemetry(telemetry_entry)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readbility, consider extracting this chunk to its own function?

@tomchop tomchop merged commit 5eee59b into log2timeline:main May 15, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants