Skip to content

feat: Add DownloadCopilotMetrics helper method#4149

Open
MasterOogway1466 wants to merge 4 commits intogoogle:masterfrom
MasterOogway1466:copilot-metrics-refactor
Open

feat: Add DownloadCopilotMetrics helper method#4149
MasterOogway1466 wants to merge 4 commits intogoogle:masterfrom
MasterOogway1466:copilot-metrics-refactor

Conversation

@MasterOogway1466
Copy link
Copy Markdown

Added DownloadCopilotMetrics helper method to simulate previous implementation of viewing copilot usage metrics. Also, commented above the older function definitions to highlight that the methods are no longer in use due to the change in API endpoint. Fixes #4136

@gmlewis gmlewis changed the title feat: add DownloadCopilotMetrics helper method feat: Add DownloadCopilotMetrics helper method Apr 11, 2026
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Apr 11, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.76%. Comparing base (33cf038) to head (cfa26f9).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4149   +/-   ##
=======================================
  Coverage   93.75%   93.76%           
=======================================
  Files         211      211           
  Lines       19687    19701   +14     
=======================================
+ Hits        18458    18472   +14     
  Misses       1031     1031           
  Partials      198      198           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @MasterOogway1466.
Please resolve the merge conflicts in all the deprecation warning comments from the master branch, then make sure you run the linter in step 4 of CONTRIBUTING.md and push the changes to this branch and we can then proceed with a full review.

@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Apr 11, 2026

@MasterOogway1466 - did you run ./script/generate.sh from step 4 of CONTRIBUTING.md?

@MasterOogway1466
Copy link
Copy Markdown
Author

Hey @gmlewis , I did run the script and I got the below issue:
image
Could you please help me understand what I'm doing wrong?

@MasterOogway1466
Copy link
Copy Markdown
Author

I'm able to get the generate and linting script to work if I skip the method in ./tools/metadata/metadata.go as shown below:
image

Is this alright or should I be doing something else?

@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Apr 11, 2026

I'm able to get the generate and linting script to work if I skip the method in ./tools/metadata/metadata.go as shown below: ...
Is this alright or should I be doing something else?

Ah, right. Since this is a helper method that has no GitHub v3 API direct correspondence, then adding this method as an exception is the correct way to proceed.

@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Apr 11, 2026

@Roemer - it would be good to get your feedback on this proposed solution to #4136.

@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Apr 11, 2026

@MasterOogway1466 - it would also be good if you could attempt to cover as many lines in your function as possible in the unit tests to keep the codecoverage reports high.

@Roemer
Copy link
Copy Markdown

Roemer commented Apr 11, 2026

@Roemer - it would be good to get your feedback on this proposed solution to #4136.

Yes I will test it with live-data in a week when I'm back at work.

testMethod(t, r, "GET")
fmt.Fprint(w, `[{invalid JSON`)
})
urlBadJson := client.BaseURL.String() + "path/to/download/badjson"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
urlBadJson := client.BaseURL.String() + "path/to/download/badjson"
urlBadJSON := client.BaseURL.String() + "path/to/download/badjson"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handling of the new Copilot Metrics Endpoints

3 participants