-
Notifications
You must be signed in to change notification settings - Fork 23
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
T2viz UI metrics #312
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
@@ -111,14 +127,23 @@ export const Text2Viz = () => { | |||
}); | |||
} else { | |||
setEditorInput(JSON.stringify(result, undefined, 4)); | |||
|
|||
// Report metric when visualization generated successfully | |||
if (usageCollection) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ? ( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
09b3aee
to
d6c41a1
Compare
Signed-off-by: Yulong Ruan <[email protected]>
Signed-off-by: Yulong Ruan <[email protected]>
Signed-off-by: Yulong Ruan <[email protected]>
Signed-off-by: Yulong Ruan <[email protected]>
Signed-off-by: Yulong Ruan <[email protected]>
d6c41a1
to
9478056
Compare
Signed-off-by: Yulong Ruan <[email protected]>
right: 16px; | ||
top: 4px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: $euiSize is 16px
if (usageCollection) { | ||
usageCollection.reportUiStats( | ||
VIS_NLQ_APP_ID, | ||
usageCollection.METRIC_TYPE.LOADED, | ||
`saved-${uuidv4()}` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity, how we are going to use those metrics? For example, how to get the statics of how many user save the visualization? the event name is with a uuid, sounds like not suitable for aggregation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we don't need it any more? @chishui any idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we don't need it any more?
You mean uuid or metric itself? We need both
tap(() => this.status$.next('RUNNING')), | ||
debounceTime(200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason for changing the order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes, it causes UI flashing.
* Add metrics for text2viz Signed-off-by: Yulong Ruan <[email protected]> * remove new line at the end of file Signed-off-by: Yulong Ruan <[email protected]> * fix imported types Signed-off-by: Yulong Ruan <[email protected]> * update changelogs Signed-off-by: Yulong Ruan <[email protected]> * fix UI flashing Signed-off-by: Yulong Ruan <[email protected]> * cleanup duplicate imports Signed-off-by: Yulong Ruan <[email protected]> --------- Signed-off-by: Yulong Ruan <[email protected]> (cherry picked from commit 519bb92) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
* Add metrics for text2viz Signed-off-by: Yulong Ruan <[email protected]> * remove new line at the end of file Signed-off-by: Yulong Ruan <[email protected]> * fix imported types Signed-off-by: Yulong Ruan <[email protected]> * update changelogs Signed-off-by: Yulong Ruan <[email protected]> * fix UI flashing Signed-off-by: Yulong Ruan <[email protected]> * cleanup duplicate imports Signed-off-by: Yulong Ruan <[email protected]> --------- Signed-off-by: Yulong Ruan <[email protected]> (cherry picked from commit 519bb92) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
[Describe what this change achieves]
Issues Resolved
[List any issues this PR will resolve]
Check List
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.