add some metrics for labelers (#7747)

* add some metrics

* add label pref switch metric

* Update src/screens/Profile/Header/ProfileHeaderLabeler.tsx

* Use new logger.metric

* Fix conflicting types

* Remove duplicate toasts

* Move metric to try body

* Move metric to try body

---------

Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
Hailey
2025-03-06 12:20:48 -08:00
committed by GitHub
parent 153fc17676
commit 618c4e4a56
4 changed files with 50 additions and 1 deletions
+6
View File
@@ -8,6 +8,7 @@ import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
import {PROD_DEFAULT_FEED} from '#/lib/constants'
import {replaceEqualDeep} from '#/lib/functions'
import {getAge} from '#/lib/strings/time'
import {logger} from '#/logger'
import {STALE} from '#/state/queries'
import {
DEFAULT_HOME_FEED_PREFS,
@@ -96,6 +97,11 @@ export function usePreferencesSetContentLabelMutation() {
>({
mutationFn: async ({label, visibility, labelerDid}) => {
await agent.setContentLabelPref(label, visibility, labelerDid)
logger.metric(
'moderation:changeLabelPreference',
{preference: visibility},
{statsig: true},
)
// triggers a refetch
await queryClient.invalidateQueries({
queryKey: preferencesQueryKey,