-
Notifications
You must be signed in to change notification settings - Fork 440
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
feat(tasks): add telemetry events to tasks #6246
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated Apr 9, 2024 10:13 AM (UTC)
|
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.
Small nitpicks on event naming (title case for all event names) + suggestion on reducing number of events.
@@ -116,9 +118,11 @@ export function TasksActivityLog(props: TasksActivityLogProps) { | |||
|
|||
onChange(set(notification.subscribers, ['subscribers'])) | |||
|
|||
operation.create(nextComment) | |||
operation.create(nextComment).then(() => { | |||
telemetry.log(TaskCommentAdded) |
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.
Nice!
Suggestion/idea: This is not in scope for this pull request, but maybe we should consider (in the future) to centralize the logging of comment-related telemetry events within the useCommentOperations
hook, rather than in the places where those operations are invoked? Currently, we do not log telemetry for comments, so we could consider this as a refactoring effort in the future when we implement telemetry for comments.
Something like this (pseudo code):
import {
TaskCommentCreated,
FieldCommentCreated,
TaskReplyCommentCreated,
FieldReplyCommentCreated,
} from '../path/to/telemetry'
import {useTelemetry} from '@sanity/telemetry'
function useCommentOperations(props: CommentOperationsHookOptions) {
const {type} = props
const telemetry = useTelemetry()
const handleCreate = useCallback(
async (nextComment) => {
await createOperation(nextComment).then(() => {
const isReply = Boolean(nextComment.parentCommentId)
if (!isReply) {
if (type === 'task') {
telemetry.log(TaskCommentCreated)
}
if (type === 'field') {
telemetry.log(FieldCommentCreated)
}
}
if (isReply) {
if (type === 'task') {
telemetry.log(TaskReplyCommentCreated)
}
if (type === 'field') {
telemetry.log(FieldReplyCommentCreated)
}
}
})
},
[telemetry, type],
)
return {
create: handleCreate,
// ... rest of the operations
}
}
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.
Thanks @hermanwikner this is a great suggestion. I'll create a issue to track that, I think we should be tracking similar events for comments specific changes, but let's raise it with the growth team
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 believe comments are tracked server-side? We do have events for Comment Posted etc in Amplitude
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.
That's right, actually I will remove this comments events from the studio and move them to the server, I can add a type
property to distinguish normal comment from tasks comments.
c19ec06
to
6ee7438
Compare
Description
Adds telemetry tracking to tasks.
What to review
Is there something else worth tracking?
Are the event names correct?
Testing
Notes for release