github-copilot-resources / copilot-metrics-viewer

Tool to visualize the Copilot metrics provided via the Copilot Business Metrics API (current in public beta)
https://ashy-sky-02a7d0403.5.azurestaticapps.net/
MIT License
215 stars 99 forks source link

Percentage calculations seem to be off #31

Closed jasontempleman-eaton closed 1 month ago

jasontempleman-eaton commented 1 month ago

Can someone please explain how the average calculations are computed?

Looking at the values in the readme for Cumulative Number of Accepted Prompts (50734) and Cumulative Number of Suggested Prompts (199097) I would expect the average would be 50734 / 199097 * 100 or 25.48% whereas the image shows 22.19%

I ran this locally again my Enterprise and the values are 20024 and 68238 so I would expect an average of 29.34% yet the value given is 20.54%

I would like to understand where these differences are coming from so that I can make sure I have the correct values.

mbroton commented 1 month ago

From what I see in src/components/MetricsViewer.vue there is calculation of acceptanceRateAverage done based on daily average value, instead of basing it on the total numbers. I would assume that's the issue, but I didn't dive too deep into the code, so I might be wrong.

martedesco commented 1 month ago

@mbroton - that's correct! I believe we should favor the total number of suggestions divided by the number of accepted prompts. I’m working on a fix for it.

martedesco commented 1 month ago

Fixed in this PR. It will be available in the release v1.5 coming tomorrow. Thanks @jasontempleman-eaton for raising this.