Skip to content

Add telemetry to the Linux Extension #221

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

Conversation

Pranshu-Negi
Copy link
Collaborator

Add telemetry to the Linux extension so that we can detect on our end if the extension starts to fail for users when a new version is rolled out.

@Pranshu-Negi Pranshu-Negi force-pushed the users/pranshunegi/add-telemetry-for-linux-extension branch from 8a13a97 to 1f60039 Compare April 26, 2023 19:05
@Pranshu-Negi Pranshu-Negi force-pushed the users/pranshunegi/add-telemetry-for-linux-extension branch from 00db3e0 to dfbbf55 Compare April 27, 2023 12:03
@Pranshu-Negi Pranshu-Negi force-pushed the users/pranshunegi/add-telemetry-for-linux-extension branch from 63a215f to 9c9e5e6 Compare April 27, 2023 14:44
@Pranshu-Negi Pranshu-Negi marked this pull request as ready for review May 2, 2023 14:28
@@ -5,6 +5,9 @@
#3. get command execution log summary
#4. api versions merge and everywhere

from __future__ import absolute_import
from __future__ import print_function
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are those two imports needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added them because the examples from aria said so. I removed them and checked, the logger in the current form doesn't need them and is working fine so these imports can be removed. However there might be a requirement to add these imports later if we develop the telemetry further.

@@ -107,6 +131,11 @@ def set_error_status_and_error_exit(e, operation_name, code = -1):
if(len(error_message) > Constants.ERROR_MESSAGE_LENGTH):
error_message = error_message[:Constants.ERROR_MESSAGE_LENGTH]
handler_utility.error('Error occured during {0}. {1}'.format(operation_name, error_message))
try:
event_logger.log_new_event("extension_failed", 'Error occured during {0}. {1}'.format(operation_name, error_message))
except Exception as e:
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need to use except Exception as e: as you're not doing anything with e, thus except Exception is enough.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, changes made

@@ -790,6 +822,11 @@ def main():
elif(input_operation == Constants.UPDATE):
update()

try:
event_logger.log_new_event("extension_succeeded", "Extension successfully installed")
except Exception as e:
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need to use except Exception as e: as you're not doing anything with e, thus except Exception is enough.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, changes made


def __init__(self):
log_config = LogConfiguration(log_level=logging.DEBUG)
configuration = LogManagerConfiguration(log_configuration = log_config)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a code style consistency nitpick.
Line 45: (log_level=logging.DEBUG) - no leading or trailing space around =
Line 46: (log_configuration = log_config) - leading and trailing space around =

Copy link
Collaborator

Choose a reason for hiding this comment

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

It will get better once we merge your PRs and add black into the repo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for pointing this out. Will take care.

@Pranshu-Negi Pranshu-Negi requested a review from tkasparek May 3, 2023 12:07
@Pranshu-Negi Pranshu-Negi merged commit ecdf903 into users/pranshunegi/fail-linux-extension-on-unsupported-os May 9, 2023
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.

2 participants