From 8cbe0e6517ddd9c5c077d07a3d4e4c81d686293e Mon Sep 17 00:00:00 2001 From: ikprk <168457495+ikprk@users.noreply.github.com> Date: Sun, 26 May 2024 19:04:48 +0200 Subject: [PATCH] :lock: Filter request response time logs hotfix (#50) * Filter request response time logs * Improve filtering on channel videos --- packages/atlas/src/api/client/index.ts | 16 +++++++++++++++- .../src/views/viewer/ChannelView/ChannelView.tsx | 13 +++---------- .../ChannelViewTabs/ChannelVideos.tsx | 14 +++----------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/packages/atlas/src/api/client/index.ts b/packages/atlas/src/api/client/index.ts index 276fad64f1..f8e236cd6e 100644 --- a/packages/atlas/src/api/client/index.ts +++ b/packages/atlas/src/api/client/index.ts @@ -3,12 +3,20 @@ import { GraphQLWsLink } from '@apollo/client/link/subscriptions' import { getMainDefinition } from '@apollo/client/utilities' import { createClient } from 'graphql-ws' -import { ORION_GRAPHQL_URL, QUERY_NODE_GRAPHQL_SUBSCRIPTION_URL } from '@/config/env' +import { + FAUCET_URL, + ORION_AUTH_URL, + ORION_GRAPHQL_URL, + QUERY_NODE_GRAPHQL_SUBSCRIPTION_URL, + YPP_FAUCET_URL, +} from '@/config/env' import { useUserLocationStore } from '@/providers/userLocation' import { UserEventsLogger } from '@/utils/logs' import { cache } from './cache' +const followedRequests = [YPP_FAUCET_URL, ORION_GRAPHQL_URL, ORION_AUTH_URL, FAUCET_URL] + const initializePerformanceObserver = () => { try { const observer = new PerformanceObserver((list) => { @@ -17,6 +25,12 @@ const initializePerformanceObserver = () => { const queryString = entry.name.split('?')?.[1] const params = new URLSearchParams(queryString) const queryType = params.get('queryName') + + // Only follow requests to Atlas infra + if (!queryType && !followedRequests.some((allowedUrl) => entry.name.includes(allowedUrl))) { + return + } + UserEventsLogger.logUserEvent('request-response-time', { requestName: queryType ?? entry.name, timeToComplete: entry.duration, diff --git a/packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx b/packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx index 73b10e6035..b3c5fe17e9 100644 --- a/packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx +++ b/packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx @@ -24,6 +24,7 @@ import { CollectorsBox } from '@/components/_channel/CollectorsBox' import { ContextMenu } from '@/components/_overlays/ContextMenu' import { ReportModal } from '@/components/_overlays/ReportModal' import { atlasConfig } from '@/config' +import { getPublicCryptoVideoFilter } from '@/config/contentFilter' import { absoluteRoutes } from '@/config/routes' import { NFT_SORT_OPTIONS, VIDEO_SORT_OPTIONS } from '@/config/sorting' import { useGetAssetUrl } from '@/hooks/useGetAssetUrl' @@ -92,20 +93,12 @@ export const ChannelView: FC = () => { tab === 'Token' ? !!tab && (isChannelOwner || !!channel?.creatorToken?.token.id) : !!tab ) const { videoCount } = useVideoCount({ - where: { + where: getPublicCryptoVideoFilter({ channel: { id_eq: id, }, - isPublic_eq: true, createdAt_lt: USER_TIMESTAMP, - isCensored_eq: false, - thumbnailPhoto: { - isAccepted_eq: true, - }, - media: { - isAccepted_eq: true, - }, - }, + }), }) const { data: nftCountData } = useGetNftsCountQuery({ variables: { diff --git a/packages/atlas/src/views/viewer/ChannelView/ChannelViewTabs/ChannelVideos.tsx b/packages/atlas/src/views/viewer/ChannelView/ChannelViewTabs/ChannelVideos.tsx index f3d82771b7..6472716bb6 100644 --- a/packages/atlas/src/views/viewer/ChannelView/ChannelViewTabs/ChannelVideos.tsx +++ b/packages/atlas/src/views/viewer/ChannelView/ChannelViewTabs/ChannelVideos.tsx @@ -7,6 +7,7 @@ import { EmptyFallback } from '@/components/EmptyFallback' import { Grid } from '@/components/Grid' import { ViewErrorFallback } from '@/components/ViewErrorFallback' import { VideoTileViewer } from '@/components/_video/VideoTileViewer' +import { getPublicCryptoVideoFilter } from '@/config/contentFilter' import { transitions } from '@/styles' import { createPlaceholderData } from '@/utils/data' import { SentryLogger } from '@/utils/logs' @@ -49,21 +50,12 @@ export const ChannelVideos: FC = ({ orderBy: sortVideosBy, limit: tilesPerPage, offset: currentPage * tilesPerPage, - where: { + where: getPublicCryptoVideoFilter({ channel: { id_eq: channelId, }, - isPublic_eq: true, createdAt_lt: USER_TIMESTAMP, - isCensored_eq: false, - isShort_eq: false, - thumbnailPhoto: { - isAccepted_eq: true, - }, - media: { - isAccepted_eq: true, - }, - }, + }), }, })