[Statsig] Add more events to downsample, increase downsample rate (#5198)
* add some events for sampling * include downsample rate in metadata * fix metadata logic * uncomment debug
This commit is contained in:
parent
adef9cff10
commit
c8be9b78c6
7 changed files with 47 additions and 37 deletions
|
@ -99,8 +99,8 @@ export function useGetPosts() {
|
|||
|
||||
export function usePostLikeMutationQueue(
|
||||
post: Shadow<AppBskyFeedDefs.PostView>,
|
||||
logContext: LogEvents['post:like']['logContext'] &
|
||||
LogEvents['post:unlike']['logContext'],
|
||||
logContext: LogEvents['post:like:sampled']['logContext'] &
|
||||
LogEvents['post:unlike:sampled']['logContext'],
|
||||
) {
|
||||
const queryClient = useQueryClient()
|
||||
const postUri = post.uri
|
||||
|
@ -158,7 +158,7 @@ export function usePostLikeMutationQueue(
|
|||
}
|
||||
|
||||
function usePostLikeMutation(
|
||||
logContext: LogEvents['post:like']['logContext'],
|
||||
logContext: LogEvents['post:like:sampled']['logContext'],
|
||||
post: Shadow<AppBskyFeedDefs.PostView>,
|
||||
) {
|
||||
const {currentAccount} = useSession()
|
||||
|
@ -175,7 +175,7 @@ function usePostLikeMutation(
|
|||
if (currentAccount) {
|
||||
ownProfile = findProfileQueryData(queryClient, currentAccount.did)
|
||||
}
|
||||
logEvent('post:like', {
|
||||
logEvent('post:like:sampled', {
|
||||
logContext,
|
||||
doesPosterFollowLiker: postAuthor.viewer
|
||||
? Boolean(postAuthor.viewer.followedBy)
|
||||
|
@ -200,12 +200,12 @@ function usePostLikeMutation(
|
|||
}
|
||||
|
||||
function usePostUnlikeMutation(
|
||||
logContext: LogEvents['post:unlike']['logContext'],
|
||||
logContext: LogEvents['post:unlike:sampled']['logContext'],
|
||||
) {
|
||||
const agent = useAgent()
|
||||
return useMutation<void, Error, {postUri: string; likeUri: string}>({
|
||||
mutationFn: ({likeUri}) => {
|
||||
logEvent('post:unlike', {logContext})
|
||||
logEvent('post:unlike:sampled', {logContext})
|
||||
return agent.deleteLike(likeUri)
|
||||
},
|
||||
onSuccess() {
|
||||
|
@ -216,8 +216,8 @@ function usePostUnlikeMutation(
|
|||
|
||||
export function usePostRepostMutationQueue(
|
||||
post: Shadow<AppBskyFeedDefs.PostView>,
|
||||
logContext: LogEvents['post:repost']['logContext'] &
|
||||
LogEvents['post:unrepost']['logContext'],
|
||||
logContext: LogEvents['post:repost:sampled']['logContext'] &
|
||||
LogEvents['post:unrepost:sampled']['logContext'],
|
||||
) {
|
||||
const queryClient = useQueryClient()
|
||||
const postUri = post.uri
|
||||
|
@ -273,7 +273,7 @@ export function usePostRepostMutationQueue(
|
|||
}
|
||||
|
||||
function usePostRepostMutation(
|
||||
logContext: LogEvents['post:repost']['logContext'],
|
||||
logContext: LogEvents['post:repost:sampled']['logContext'],
|
||||
) {
|
||||
const agent = useAgent()
|
||||
return useMutation<
|
||||
|
@ -282,7 +282,7 @@ function usePostRepostMutation(
|
|||
{uri: string; cid: string} // the post's uri and cid
|
||||
>({
|
||||
mutationFn: post => {
|
||||
logEvent('post:repost', {logContext})
|
||||
logEvent('post:repost:sampled', {logContext})
|
||||
return agent.repost(post.uri, post.cid)
|
||||
},
|
||||
onSuccess() {
|
||||
|
@ -292,12 +292,12 @@ function usePostRepostMutation(
|
|||
}
|
||||
|
||||
function usePostUnrepostMutation(
|
||||
logContext: LogEvents['post:unrepost']['logContext'],
|
||||
logContext: LogEvents['post:unrepost:sampled']['logContext'],
|
||||
) {
|
||||
const agent = useAgent()
|
||||
return useMutation<void, Error, {postUri: string; repostUri: string}>({
|
||||
mutationFn: ({repostUri}) => {
|
||||
logEvent('post:unrepost', {logContext})
|
||||
logEvent('post:unrepost:sampled', {logContext})
|
||||
return agent.deleteRepost(repostUri)
|
||||
},
|
||||
onSuccess() {
|
||||
|
|
|
@ -219,8 +219,8 @@ export function useProfileUpdateMutation() {
|
|||
|
||||
export function useProfileFollowMutationQueue(
|
||||
profile: Shadow<AppBskyActorDefs.ProfileViewDetailed>,
|
||||
logContext: LogEvents['profile:follow']['logContext'] &
|
||||
LogEvents['profile:unfollow']['logContext'],
|
||||
logContext: LogEvents['profile:follow:sampled']['logContext'] &
|
||||
LogEvents['profile:follow:sampled']['logContext'],
|
||||
) {
|
||||
const agent = useAgent()
|
||||
const queryClient = useQueryClient()
|
||||
|
@ -291,7 +291,7 @@ export function useProfileFollowMutationQueue(
|
|||
}
|
||||
|
||||
function useProfileFollowMutation(
|
||||
logContext: LogEvents['profile:follow']['logContext'],
|
||||
logContext: LogEvents['profile:follow:sampled']['logContext'],
|
||||
profile: Shadow<AppBskyActorDefs.ProfileViewDetailed>,
|
||||
) {
|
||||
const {currentAccount} = useSession()
|
||||
|
@ -306,7 +306,7 @@ function useProfileFollowMutation(
|
|||
ownProfile = findProfileQueryData(queryClient, currentAccount.did)
|
||||
}
|
||||
captureAction(ProgressGuideAction.Follow)
|
||||
logEvent('profile:follow', {
|
||||
logEvent('profile:follow:sampled', {
|
||||
logContext,
|
||||
didBecomeMutual: profile.viewer
|
||||
? Boolean(profile.viewer.followedBy)
|
||||
|
@ -323,12 +323,12 @@ function useProfileFollowMutation(
|
|||
}
|
||||
|
||||
function useProfileUnfollowMutation(
|
||||
logContext: LogEvents['profile:unfollow']['logContext'],
|
||||
logContext: LogEvents['profile:unfollow:sampled']['logContext'],
|
||||
) {
|
||||
const agent = useAgent()
|
||||
return useMutation<void, Error, {did: string; followUri: string}>({
|
||||
mutationFn: async ({followUri}) => {
|
||||
logEvent('profile:unfollow', {logContext})
|
||||
logEvent('profile:unfollow:sampled', {logContext})
|
||||
track('Profile:Unfollow', {username: followUri})
|
||||
return await agent.deleteFollow(followUri)
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue