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

telemetry(amazonq): Add metrics utility to instrument generated patch… #5094

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

ctidd
Copy link
Contributor

@ctidd ctidd commented Nov 15, 2024

telemetry(amazonq): Add metrics utility to instrument generated patches applied to existing code.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

Problem: We do not yet instrument "lines of code generated" or "lines of code accepted" for patches to existing files. To do this requires inspecting a diff and applying some heuristics around what we count, focused on collecting the count of generated or accepted code (i.e. sum of lines inserted/modified).

Solution: This utility enables us to diff the before/after content of a file and report the number of lines of code in the diff. The solutions counts inserted/modified lines, and counts characters within each line, excluding leading and trailing whitespace.

The solution may be considered naive in the following ways, by design:

  • Performing a whitespace-sensitive diff
  • Counting chars, as opposed to graphemes
  • Counting empty lines and trailing newlines
  • Not counting deleted lines

The solution is tested to pin down these behaviors, which may be subject to future changes.

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ctidd ctidd requested a review from a team as a code owner November 15, 2024 23:30
@ctidd ctidd merged commit 2c20422 into aws:main Nov 18, 2024
12 of 13 checks passed
dhasani23 pushed a commit to ntarakad-aws/aws-toolkit-jetbrains that referenced this pull request Nov 18, 2024
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.

3 participants