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

T2viz UI metrics #312

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

ruanyl
Copy link
Member

@ruanyl ruanyl commented Sep 14, 2024

Description

[Describe what this change achieves]

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test.
  • New functionality has user manual doc added.
  • Commits are signed per the DCO using --signoff.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Sep 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.65%. Comparing base (4e68047) to head (ce386b6).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #312      +/-   ##
==========================================
+ Coverage   88.59%   88.65%   +0.06%     
==========================================
  Files          60       61       +1     
  Lines        1710     1728      +18     
  Branches      419      426       +7     
==========================================
+ Hits         1515     1532      +17     
- Misses        193      194       +1     
  Partials        2        2              

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

Signed-off-by: Yulong Ruan <[email protected]>
Signed-off-by: Yulong Ruan <[email protected]>
@@ -111,14 +127,23 @@ export const Text2Viz = () => {
});
} else {
setEditorInput(JSON.stringify(result, undefined, 4));

// Report metric when visualization generated successfully
if (usageCollection) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could use METRIC_TYPE.COUNT to either record a 1 for success or 0 for failure. We could calculate average to get success rate.

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently, it doesn't record the failures. If we do need to record the failures, I'd rather use another event type, like:

  usageCollection.reportUiStats(
    VIS_NLQ_APP_ID,
    usageCollection.METRIC_TYPE.LOADED,
    `generate_failed-${uuidv4()}`
  );

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean we could use the same metric, and emit 0 when fails, 1 when succeeds. Like

try {
 const response = await fetch();
emitMetric("fetch_success", COUNT, 1);
} catch( err: any) {
emitMetric("fetch_success", COUNT, 0);
}

We always ensure that we emit one time for a fetch, it's either 1 or 0.

@@ -410,6 +444,13 @@ export const Text2Viz = () => {
paddingSize="none"
scrollable={false}
>
{usageCollection ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC, usageCollection is always available, the feature flag only controls whether it can send metrics to server.

Copy link
Member Author

Choose a reason for hiding this comment

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

usageCollection is declared as an optional plugin of dashboards-assistant plugin. Theoretically, it can be undefined.

}

export const FeedbackThumbs = ({ usageCollection, appName, className }: Props) => {
const [feedback, setFeedback] = useState<'thumbs_up' | 'thumbs_down' | undefined>();
Copy link
Contributor

Choose a reason for hiding this comment

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

If visualization is regenerated, will feedback be reset?

Copy link
Member Author

@ruanyl ruanyl Sep 14, 2024

Choose a reason for hiding this comment

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

Yes, it will reset because the FeedbackThumbs component will be re-rendered.

Signed-off-by: Yulong Ruan <[email protected]>
@ruanyl ruanyl added the backport 2.x Trigger the backport flow to 2.x label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Trigger the backport flow to 2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants