-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[No QA] Fix ManualSendMessage metrics measurements #82321
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
e049759
8b06a71
447467a
e79e241
87b4c97
506c5a5
f756382
567daab
b598864
9f5a0fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -52,8 +52,16 @@ function cancelAllSpans() { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| function cancelSpansByPrefix(prefix: string) { | ||||||
| for (const [spanId] of activeSpans.entries()) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per code style conventions:
Suggested change
|
||||||
| if (spanId.startsWith(prefix)) { | ||||||
| cancelSpan(spanId); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| function getSpan(spanId: string) { | ||||||
| return activeSpans.get(spanId); | ||||||
| } | ||||||
|
|
||||||
| export {startSpan, endSpan, getSpan, cancelSpan, cancelAllSpans}; | ||||||
| export {startSpan, endSpan, getSpan, cancelSpan, cancelAllSpans, cancelSpansByPrefix}; | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import lodashDebounce from 'lodash/debounce'; | ||
| import noop from 'lodash/noop'; | ||
| import React, {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'; | ||
| import React, {memo, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react'; | ||
| import type {BlurEvent, MeasureInWindowOnSuccessCallback, TextInputSelectionChangeEvent} from 'react-native'; | ||
| import {View} from 'react-native'; | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
|
|
@@ -38,6 +38,7 @@ | |
| import DomUtils from '@libs/DomUtils'; | ||
| import FS from '@libs/Fullstory'; | ||
| import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; | ||
| import {rand64} from '@libs/NumberUtils'; | ||
| import Performance from '@libs/Performance'; | ||
| import {getLinkedTransactionID, getReportAction, isMoneyRequestAction} from '@libs/ReportActionsUtils'; | ||
| import { | ||
|
|
@@ -64,6 +65,7 @@ | |
| import AgentZeroProcessingRequestIndicator from '@pages/inbox/report/AgentZeroProcessingRequestIndicator'; | ||
| import ParticipantLocalTime from '@pages/inbox/report/ParticipantLocalTime'; | ||
| import ReportTypingIndicator from '@pages/inbox/report/ReportTypingIndicator'; | ||
| import {ActionListContext} from '@pages/inbox/ReportScreenContext'; | ||
| import {hideEmojiPicker, isActive as isActiveEmojiPickerAction, isEmojiPickerVisible} from '@userActions/EmojiPickerAction'; | ||
| import {addAttachmentWithComment, setIsComposerFullSize} from '@userActions/Report'; | ||
| import {isBlockedFromConcierge as isBlockedFromConciergeUserAction} from '@userActions/User'; | ||
|
|
@@ -91,7 +93,7 @@ | |
|
|
||
| type ReportActionComposeProps = Pick<ComposerWithSuggestionsProps, 'reportID' | 'isComposerFullSize' | 'lastReportAction'> & { | ||
| /** A method to call when the form is submitted */ | ||
| onSubmit: (newComment: string) => void; | ||
| onSubmit: (newComment: string, reportActionID?: string) => void; | ||
|
|
||
| /** The report currently being looked at */ | ||
| report: OnyxEntry<OnyxTypes.Report>; | ||
|
|
@@ -165,6 +167,8 @@ | |
| canBeMissing: true, | ||
| }); | ||
| const ancestors = useAncestors(transactionThreadReport ?? report); | ||
| const {scrollPosition} = useContext(ActionListContext); | ||
|
|
||
| /** | ||
| * Updates the Highlight state of the composer | ||
| */ | ||
|
|
@@ -355,16 +359,20 @@ | |
| }); | ||
| attachmentFileRef.current = null; | ||
| } else { | ||
| Performance.markStart(CONST.TIMING.SEND_MESSAGE, {message: newCommentTrimmed}); | ||
| startSpan(CONST.TELEMETRY.SPAN_SEND_MESSAGE, { | ||
| name: 'send-message', | ||
| op: CONST.TELEMETRY.SPAN_SEND_MESSAGE, | ||
| attributes: { | ||
| [CONST.TELEMETRY.ATTRIBUTE_REPORT_ID]: reportID, | ||
| [CONST.TELEMETRY.ATTRIBUTE_MESSAGE_LENGTH]: newCommentTrimmed.length, | ||
| }, | ||
| }); | ||
| onSubmit(newCommentTrimmed); | ||
| const reportActionID = rand64(); | ||
| const isScrolledToBottom = !scrollPosition?.offset || scrollPosition.offset < CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD; | ||
|
||
| if (isScrolledToBottom) { | ||
| Performance.markStart(CONST.TIMING.SEND_MESSAGE, {message: newCommentTrimmed}); | ||
| startSpan(`${CONST.TELEMETRY.SPAN_SEND_MESSAGE}_${reportActionID}`, { | ||
|
Comment on lines
+367
to
+368
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This starts a Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's fine, we only want to measure the text messages There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we cleanup when the user moves away from the report page, so we won't have inflated spans |
||
| name: 'send-message', | ||
| op: CONST.TELEMETRY.SPAN_SEND_MESSAGE, | ||
| attributes: { | ||
| [CONST.TELEMETRY.ATTRIBUTE_REPORT_ID]: reportID, | ||
| [CONST.TELEMETRY.ATTRIBUTE_MESSAGE_LENGTH]: newCommentTrimmed.length, | ||
| }, | ||
| }); | ||
| } | ||
| onSubmit(newCommentTrimmed, reportActionID); | ||
| } | ||
| }, | ||
| [ | ||
|
|
@@ -378,6 +386,7 @@ | |
| personalDetail.timezone, | ||
| isInSidePanel, | ||
| onSubmit, | ||
| scrollPosition, | ||
|
Check failure on line 389 in src/pages/inbox/report/ReportActionCompose/ReportActionCompose.tsx
|
||
| ], | ||
| ); | ||
|
|
||
|
|
||
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.
question: Would an alternative here be to return the
reportActionIDfor the newly created actions? that way it doesn't have to be passed in. NAB