-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(autofix): Add key analytics events #92533
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
Changes from all commits
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ import {useTypingAnimation} from 'sentry/components/events/autofix/useTypingAnim | |
import {IconChevron, IconClose} from 'sentry/icons'; | ||
import {t, tn} from 'sentry/locale'; | ||
import {space} from 'sentry/styles/space'; | ||
import {trackAnalytics} from 'sentry/utils/analytics'; | ||
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. Also mistake? |
||
import {singleLineRenderer} from 'sentry/utils/marked/marked'; | ||
import {MarkedText} from 'sentry/utils/marked/markedText'; | ||
import {useMutation, useQueryClient} from 'sentry/utils/queryClient'; | ||
|
@@ -166,6 +167,14 @@ function AutofixInsightCard({ | |
size="sm" | ||
title={t('Redo work from here')} | ||
aria-label={t('Redo work from here')} | ||
analyticsEventName="Autofix: Insight Card Rethink Open" | ||
analyticsEventKey="autofix.insight.rethink_open" | ||
analyticsParams={{ | ||
insight_card_index: index, | ||
step_index: stepIndex, | ||
group_id: groupId, | ||
run_id: runId, | ||
}} | ||
> | ||
{'\u23CE'} | ||
</Button> | ||
|
@@ -213,6 +222,14 @@ function AutofixInsightCard({ | |
icon={<FlippedReturnIcon />} | ||
aria-label={t('Edit insight')} | ||
title={t('Rethink the answer from here')} | ||
analyticsEventName="Autofix: Insight Card Rethink" | ||
analyticsEventKey="autofix.insight.rethink" | ||
analyticsParams={{ | ||
insight_card_index: index, | ||
step_index: stepIndex, | ||
group_id: groupId, | ||
run_id: runId, | ||
}} | ||
/> | ||
</RightSection> | ||
</InsightCardRow> | ||
|
@@ -307,6 +324,8 @@ function CollapsibleChainLink({ | |
const [newInsightText, setNewInsightText] = useState(''); | ||
const {mutate: updateInsight} = useUpdateInsightCard({groupId, runId}); | ||
|
||
const organization = useOrganization(); | ||
|
||
const handleSubmit = (e: React.FormEvent) => { | ||
e.preventDefault(); | ||
setIsAdding(false); | ||
|
@@ -317,6 +336,13 @@ function CollapsibleChainLink({ | |
insightCount !== undefined && insightCount > 0 ? insightCount : null, | ||
}); | ||
setNewInsightText(''); | ||
|
||
trackAnalytics('autofix.step.rethink', { | ||
step_index: stepIndex, | ||
group_id: groupId, | ||
run_id: runId, | ||
organization, | ||
}); | ||
}; | ||
|
||
const handleCancel = () => { | ||
|
@@ -405,6 +431,13 @@ function CollapsibleChainLink({ | |
onClick={() => setIsAdding(true)} | ||
title={t('Give feedback and rethink the answer')} | ||
aria-label={t('Give feedback and rethink the answer')} | ||
analyticsEventName="Autofix: Step Rethink Open" | ||
analyticsEventKey="autofix.step.rethink_open" | ||
analyticsParams={{ | ||
step_index: stepIndex, | ||
group_id: groupId, | ||
run_id: runId, | ||
}} | ||
> | ||
<RethinkLabel>{t('Rethink this answer')}</RethinkLabel> | ||
<FlippedReturnIcon /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ import {Timeline} from 'sentry/components/timeline'; | |
import {IconAdd, IconChat, IconFix} from 'sentry/icons'; | ||
import {t} from 'sentry/locale'; | ||
import {space} from 'sentry/styles/space'; | ||
import {trackAnalytics} from 'sentry/utils/analytics'; | ||
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. Mistake? |
||
import {singleLineRenderer} from 'sentry/utils/marked/marked'; | ||
import {valueIsEqual} from 'sentry/utils/object/valueIsEqual'; | ||
import {setApiQueryData, useMutation, useQueryClient} from 'sentry/utils/queryClient'; | ||
|
@@ -305,6 +306,8 @@ function CopySolutionButton({ | |
text={text} | ||
borderless | ||
title="Copy solution as Markdown" | ||
analyticsEventName="Autofix: Copy Solution as Markdown" | ||
analyticsEventKey="autofix.solution.copy" | ||
/> | ||
); | ||
} | ||
|
@@ -320,6 +323,8 @@ function AutofixSolutionDisplay({ | |
solutionSelected, | ||
agentCommentThread, | ||
}: Omit<AutofixSolutionProps, 'repos'>) { | ||
const organization = useOrganization(); | ||
|
||
const {repos} = useAutofixRepos(groupId); | ||
const {mutate: handleContinue, isPending} = useSelectSolution({groupId, runId}); | ||
const [isEditing, _setIsEditing] = useState(false); | ||
|
@@ -367,6 +372,12 @@ function AutofixSolutionDisplay({ | |
|
||
// Clear the input | ||
setInstructions(''); | ||
|
||
trackAnalytics('autofix.solution.add_step', { | ||
organization, | ||
solution: solutionItems, | ||
newStep, | ||
}); | ||
} | ||
}; | ||
|
||
|
@@ -375,17 +386,37 @@ function AutofixSolutionDisplay({ | |
handleAddInstruction(); | ||
}; | ||
|
||
const handleDeleteItem = useCallback((index: number) => { | ||
setSolutionItems(current => current.filter((_, i) => i !== index)); | ||
}, []); | ||
const handleDeleteItem = useCallback( | ||
(index: number) => { | ||
setSolutionItems(current => current.filter((_, i) => i !== index)); | ||
|
||
const handleToggleActive = useCallback((index: number) => { | ||
setSolutionItems(current => | ||
current.map((item, i) => | ||
i === index ? {...item, is_active: item.is_active === false ? true : false} : item | ||
) | ||
); | ||
}, []); | ||
trackAnalytics('autofix.solution.delete_step', { | ||
organization, | ||
solution: solutionItems, | ||
deletedStep: solutionItems[index], | ||
}); | ||
}, | ||
[organization, solutionItems] | ||
); | ||
|
||
const handleToggleActive = useCallback( | ||
(index: number) => { | ||
setSolutionItems(current => | ||
current.map((item, i) => | ||
i === index | ||
? {...item, is_active: item.is_active === false ? true : false} | ||
: item | ||
) | ||
); | ||
|
||
trackAnalytics('autofix.solution.toggle_step', { | ||
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. Name should probably be more clear that this is disabling the agent's step vs deleting the human's own step |
||
organization, | ||
solution: solutionItems, | ||
toggledStep: solutionItems[index], | ||
}); | ||
}, | ||
[organization, solutionItems] | ||
); | ||
|
||
useEffect(() => { | ||
setSolutionItems( | ||
|
@@ -439,6 +470,8 @@ function AutofixSolutionDisplay({ | |
borderless | ||
title={t('Chat with Seer')} | ||
onClick={handleSelectDescription} | ||
analyticsEventName="Autofix: Solution Chat" | ||
analyticsEventKey="autofix.solution.chat" | ||
> | ||
<IconChat size="xs" /> | ||
</ChatButton> | ||
|
@@ -476,6 +509,8 @@ function AutofixSolutionDisplay({ | |
solution: solutionItems, | ||
}); | ||
}} | ||
analyticsEventName="Autofix: Code It Up" | ||
analyticsEventKey="autofix.solution.code" | ||
> | ||
{t('Code It Up')} | ||
</Button> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,8 @@ interface InsightCardObject { | |
id: string; | ||
insight: string | null | undefined; | ||
title: string; | ||
copyAnalyticsEventKey?: string; | ||
copyAnalyticsEventName?: string; | ||
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. What's this doing? |
||
copyText?: string | null; | ||
copyTitle?: string | null; | ||
icon?: React.ReactNode; | ||
|
@@ -175,6 +177,8 @@ function AutofixSummary({ | |
}, | ||
copyTitle: t('Copy root cause as Markdown'), | ||
copyText: rootCauseCopyText, | ||
copyAnalyticsEventName: 'Autofix: Copy Root Cause as Markdown', | ||
copyAnalyticsEventKey: 'autofix.root_cause.copy', | ||
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. What's this doing? |
||
}, | ||
|
||
...(solutionDescription || solutionIsLoading | ||
|
@@ -200,6 +204,8 @@ function AutofixSummary({ | |
}, | ||
copyTitle: t('Copy solution as Markdown'), | ||
copyText: solutionCopyText, | ||
copyAnalyticsEventName: 'Autofix: Copy Solution as Markdown', | ||
copyAnalyticsEventKey: 'autofix.solution.copy', | ||
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. What's this doing? |
||
}, | ||
] | ||
: []), | ||
|
@@ -256,6 +262,8 @@ function AutofixSummary({ | |
onClick={e => { | ||
e.stopPropagation(); | ||
}} | ||
analyticsEventName={card.copyAnalyticsEventName} | ||
analyticsEventKey={card.copyAnalyticsEventKey} | ||
/> | ||
)} | ||
</CardTitle> | ||
|
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.
This seems like mistake?