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

[ai-did-you-mean-this] Add custom telemetry module and improve handling of different failure scenarios. #2191

Merged
merged 14 commits into from
Aug 22, 2020

Conversation

christopher-o-toole
Copy link
Contributor

  • Log custom telemetry data when given permission by the user to do so.
    • Record exceptions thrown by the extension.
    • Track various performance and health metrics.
    • Track what suggestions are shown.
  • Fix incorrect parsing of argument placeholders.
  • Support parameter prefix matching for feature parity with the CLI parser.
  • Add preliminary support for partial command matching
    • Fixes bug where certain command groups are not recognized.
  • Improve handling of extension debug logs.
  • Store extension version in a centralized location to improve maintainability.
  • Expand unit test coverage.

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

Christopher OToole added 11 commits July 22, 2020 15:38
(cherry picked from commit 512cb17)
…matching, store version in centralized location, improve debug logger handling, expand unit test coverage. use type hints in some files to improve intellisense
… handle suggestion parse failure, rework telemetry naming and descriptions, make enums easier to use, fix odd copyright header formatting,
…sponse, update suggestion encoder to use correct delimiters.
…parameter blocklist, refactor command parameter normalization unit tests, simplify some code and improve readability, rename `UnknownException` to something more pythonic.
@yonzhan
Copy link
Collaborator

yonzhan commented Aug 17, 2020

ai-did-you-mean-this

@yungezz
Copy link
Member

yungezz commented Aug 17, 2020

hi @bim-msft could you pls review this PR? thanks

@bim-msft bim-msft self-requested a review August 17, 2020 09:14
Copy link
Contributor

@bim-msft bim-msft left a comment

Choose a reason for hiding this comment

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

LGTM

if arguments_len < parameters_len:
missing_argument_count = parameters_len - arguments_len
for _ in range(missing_argument_count):
self.arguments.append('')
Copy link
Member

Choose a reason for hiding this comment

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

how to align parameters with argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The model used by the service should already have its parameters and arguments aligned. The checks performed here are intended to help test the model and validate results returned by the service.

Example of this behavior in action:

Scenario(
    cli_command=CliCommand('account get-access-token', ['--test', '--debug'], 'a'),
    expected_user_fault_type=UserFaultType.UNRECOGNIZED_ARGUMENTS
)

Specifying no argument for the --debug flag results in an empty string being added to the arguments array.

The only way to have more arguments returned than parameters is some sort of model error or client-side parsing error.



class ExtensionTelemterySession():
def __enter__(self):
Copy link
Member

Choose a reason for hiding this comment

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

any exception handling on enter besides clear()?

_set_exception_func_orig = telemetry.set_exception
_add_extension_event_func_orig = telemetry.add_extension_event

def _set_exception_hook(exception: Exception, fault_type: str, *args, summary: str = None, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

nice!

return hash(self.value)


class TelemetryProperty(Enum):
Copy link
Member

Choose a reason for hiding this comment

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

curious, where to read your ai key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed comment in offline conversation.

Christopher OToole added 2 commits August 18, 2020 21:26
…nner. Better invalid suggestion handling. Move telemetry property prefix to the `_telemetry` file to make it easier to find.
@yungezz yungezz merged commit ae10387 into Azure:master Aug 22, 2020
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.

5 participants