diff options
author | Eric Bailey <git@esb.lol> | 2025-02-28 17:13:49 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-28 17:13:49 -0600 |
commit | 96f4f6359add6a4f2a37df8f17cf3f2f59f0a2a6 (patch) | |
tree | afabc0fe9628a66f1db69f9e07b824db725aa6e1 /src/logger/metrics.ts | |
parent | 9e59a2eef2f82511a9a9a056dbdb0c62fe2f61c6 (diff) | |
download | voidsky-96f4f6359add6a4f2a37df8f17cf3f2f59f0a2a6.tar.zst |
Logger metrics (#7867)
* Adjust datalake abstraction (cherry picked from commit 8ba6a8d45b1bd5698afbd06d9e858a91789f0ea6) * Just be really really specific (cherry picked from commit 920198959659329a7f7f7282a1293aaad198d8e3) * Add metric method to logger, replace datalake calls with new method (cherry picked from commit 7a026bbeae75514b64f928d7ff59707c518fd5e5) * Clarify types (cherry picked from commit 422b150deb158a70ef37e8a456d91bf26cd0b1bc)
Diffstat (limited to 'src/logger/metrics.ts')
-rw-r--r-- | src/logger/metrics.ts | 308 |
1 files changed, 308 insertions, 0 deletions
diff --git a/src/logger/metrics.ts b/src/logger/metrics.ts new file mode 100644 index 000000000..e3bd93314 --- /dev/null +++ b/src/logger/metrics.ts @@ -0,0 +1,308 @@ +export type MetricEvents = { + // App events + init: { + initMs: number + } + 'account:loggedIn': { + logContext: + | 'LoginForm' + | 'SwitchAccount' + | 'ChooseAccountForm' + | 'Settings' + | 'Notification' + withPassword: boolean + } + 'account:loggedOut': { + logContext: + | 'SwitchAccount' + | 'Settings' + | 'SignupQueued' + | 'Deactivated' + | 'Takendown' + scope: 'current' | 'every' + } + 'notifications:openApp': {} + 'notifications:request': { + context: 'StartOnboarding' | 'AfterOnboarding' | 'Login' | 'Home' + status: 'granted' | 'denied' | 'undetermined' + } + 'state:background': { + secondsActive: number + } + 'state:foreground': {} + 'router:navigate': { + from?: string + } + 'deepLink:referrerReceived': { + to: string + referrer: string + hostname: string + } + + // Screen events + 'splash:signInPressed': {} + 'splash:createAccountPressed': {} + 'signup:nextPressed': { + activeStep: number + phoneVerificationRequired?: boolean + } + 'signup:backPressed': { + activeStep: number + } + 'signup:captchaSuccess': {} + 'signup:captchaFailure': {} + 'signin:hostingProviderPressed': { + hostingProviderDidChange: boolean + } + 'signin:hostingProviderFailedResolution': {} + 'signin:success': { + failedAttemptsCount: number + isUsingCustomProvider: boolean + timeTakenSeconds: number + } + 'signin:backPressed': { + failedAttemptsCount: number + } + 'signin:forgotPasswordPressed': {} + 'signin:passwordReset': {} + 'signin:passwordResetSuccess': {} + 'signin:passwordResetFailure': {} + 'onboarding:interests:nextPressed': { + selectedInterests: string[] + selectedInterestsLength: number + } + 'onboarding:suggestedAccounts:nextPressed': { + selectedAccountsLength: number + skipped: boolean + } + 'onboarding:followingFeed:nextPressed': {} + 'onboarding:algoFeeds:nextPressed': { + selectedPrimaryFeeds: string[] + selectedPrimaryFeedsLength: number + selectedSecondaryFeeds: string[] + selectedSecondaryFeedsLength: number + } + 'onboarding:topicalFeeds:nextPressed': { + selectedFeeds: string[] + selectedFeedsLength: number + } + 'onboarding:moderation:nextPressed': {} + 'onboarding:profile:nextPressed': {} + 'onboarding:finished:nextPressed': { + usedStarterPack: boolean + starterPackName?: string + starterPackCreator?: string + starterPackUri?: string + profilesFollowed: number + feedsPinned: number + } + 'onboarding:finished:avatarResult': { + avatarResult: 'default' | 'created' | 'uploaded' + } + 'home:feedDisplayed': { + feedUrl: string + feedType: string + index: number + } + 'feed:endReached': { + feedUrl: string + feedType: string + itemCount: number + } + 'feed:refresh': { + feedUrl: string + feedType: string + reason: 'pull-to-refresh' | 'soft-reset' | 'load-latest' + } + 'discover:showMore': { + feedContext: string + } + 'discover:showLess': { + feedContext: string + } + 'discover:clickthrough': { + count: number + } + 'discover:engaged': { + count: number + } + 'discover:seen': { + count: number + } + + 'composer:gif:open': {} + 'composer:gif:select': {} + + // Data events + 'account:create:begin': {} + 'account:create:success': {} + 'post:create': { + imageCount: number + isReply: boolean + isPartOfThread: boolean + hasLink: boolean + hasQuote: boolean + langs: string + logContext: 'Composer' + } + 'thread:create': { + postCount: number + isReply: boolean + } + 'post:like': { + doesLikerFollowPoster: boolean | undefined + doesPosterFollowLiker: boolean | undefined + likerClout: number | undefined + postClout: number | undefined + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' + } + 'post:repost': { + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' + } + 'post:unlike': { + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' + } + 'post:unrepost': { + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' + } + 'post:mute': {} + 'post:unmute': {} + 'post:pin': {} + 'post:unpin': {} + 'profile:follow': { + didBecomeMutual: boolean | undefined + followeeClout: number | undefined + followerClout: number | undefined + logContext: + | 'RecommendedFollowsItem' + | 'PostThreadItem' + | 'ProfileCard' + | 'ProfileHeader' + | 'ProfileHeaderSuggestedFollows' + | 'ProfileMenu' + | 'ProfileHoverCard' + | 'AvatarButton' + | 'StarterPackProfilesList' + | 'FeedInterstitial' + | 'ProfileHeaderSuggestedFollows' + | 'PostOnboardingFindFollows' + | 'ImmersiveVideo' + } + 'suggestedUser:follow': { + logContext: + | 'Explore' + | 'InterstitialDiscover' + | 'InterstitialProfile' + | 'Profile' + location: 'Card' | 'Profile' + recId?: number + position: number + } + 'suggestedUser:press': { + logContext: 'Explore' | 'InterstitialDiscover' | 'InterstitialProfile' + recId?: number + position: number + } + 'suggestedUser:seen': { + logContext: 'Explore' | 'InterstitialDiscover' | 'InterstitialProfile' + recId?: number + position: number + } + 'profile:unfollow': { + logContext: + | 'RecommendedFollowsItem' + | 'PostThreadItem' + | 'ProfileCard' + | 'ProfileHeader' + | 'ProfileHeaderSuggestedFollows' + | 'ProfileMenu' + | 'ProfileHoverCard' + | 'Chat' + | 'AvatarButton' + | 'StarterPackProfilesList' + | 'FeedInterstitial' + | 'ProfileHeaderSuggestedFollows' + | 'PostOnboardingFindFollows' + | 'ImmersiveVideo' + } + 'chat:create': { + logContext: 'ProfileHeader' | 'NewChatDialog' | 'SendViaChatDialog' + } + 'chat:open': { + logContext: + | 'ProfileHeader' + | 'NewChatDialog' + | 'ChatsList' + | 'SendViaChatDialog' + } + 'starterPack:share': { + starterPack: string + shareType: 'link' | 'qrcode' + qrShareType?: 'save' | 'copy' | 'share' + } + 'starterPack:followAll': { + logContext: 'StarterPackProfilesList' | 'Onboarding' + starterPack: string + count: number + } + 'starterPack:delete': {} + 'starterPack:create': { + setName: boolean + setDescription: boolean + profilesCount: number + feedsCount: number + } + 'starterPack:ctaPress': { + starterPack: string + } + 'starterPack:opened': { + starterPack: string + } + 'link:clicked': { + url: string + domain: string + } + + 'feed:interstitial:feedCard:press': {} + + 'profile:header:suggestedFollowsCard:press': {} + + 'test:all:always': {} + 'test:all:sometimes': {} + 'test:all:boosted_by_gate1': {reason: 'base' | 'gate1'} + 'test:all:boosted_by_gate2': {reason: 'base' | 'gate2'} + 'test:all:boosted_by_both': {reason: 'base' | 'gate1' | 'gate2'} + 'test:gate1:always': {} + 'test:gate1:sometimes': {} + 'test:gate2:always': {} + 'test:gate2:sometimes': {} + + 'tmd:share': {} + 'tmd:download': {} + 'tmd:post': {} + + 'trendingTopics:show': { + context: 'settings' + } + 'trendingTopics:hide': { + context: 'settings' | 'sidebar' | 'interstitial' | 'explore:trending' + } + 'trendingTopic:click': { + context: 'sidebar' | 'interstitial' | 'explore' + } + 'recommendedTopic:click': { + context: 'explore' + } + 'trendingVideos:show': { + context: 'settings' + } + 'trendingVideos:hide': { + context: 'settings' | 'interstitial:discover' | 'interstitial:explore' + } + 'videoCard:click': { + context: 'interstitial:discover' | 'interstitial:explore' | 'feed' + } + + 'progressGuide:hide': {} + 'progressGuide:followDialog:open': {} +} |