diff --git a/docker/.env.example b/docker/.env.example index 6d101403b72..2f2b3070e8d 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -81,4 +81,7 @@ IMGPROXY_ENABLE_WEBP_DETECTION=true # Configure Logflare API Calls LOGFLARE_API_KEY=api-key -LOGFLARE_URL=http://localhost:54328 \ No newline at end of file +LOGFLARE_URL=http://localhost:54328 + +# Enable logging and observability in the UI +NEXT_PUBLIC_ENABLE_LOGS=true \ No newline at end of file diff --git a/studio/.env b/studio/.env index 236f623b6f9..adaf247319b 100644 --- a/studio/.env +++ b/studio/.env @@ -17,3 +17,4 @@ LOGFLARE_URL=http://localhost:54329 NEXT_PUBLIC_SITE_URL=http://localhost:3000 NEXT_PUBLIC_GOTRUE_URL=$SUPABASE_PUBLIC_URL/auth/v1 NEXT_PUBLIC_HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 +NEXT_PUBLIC_ENABLE_LOGS=true \ No newline at end of file diff --git a/studio/components/interfaces/Settings/Logs/Logs.constants.ts b/studio/components/interfaces/Settings/Logs/Logs.constants.ts index e0e5c686ec2..c1cb707456d 100644 --- a/studio/components/interfaces/Settings/Logs/Logs.constants.ts +++ b/studio/components/interfaces/Settings/Logs/Logs.constants.ts @@ -1,4 +1,5 @@ import dayjs from 'dayjs' +import { IS_PLATFORM } from 'lib/constants' import { DatetimeHelper, FilterTableSet, LogTemplate } from '.' export const LOGS_EXPLORER_DOCS_URL = @@ -665,3 +666,5 @@ export const TIER_QUERY_LIMITS: { TEAM: { text: '90 days', value: 90, unit: 'day', promptUpgrade: false }, ENTERPRISE: { text: '90 days', value: 90, unit: 'day', promptUpgrade: false }, } + +export const SHOW_O11Y = IS_PLATFORM ? true : process.env.NEXT_PUBLIC_ENABLE_LOGS == 'true' diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx index bc052104c5a..783e7b4aeb9 100644 --- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx +++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx @@ -13,6 +13,7 @@ import SVG from 'react-inlinesvg' import { ProjectBase } from 'types' import { Route } from 'components/ui/ui.types' import { BASE_PATH, IS_PLATFORM, PROJECT_STATUS } from 'lib/constants' +import { SHOW_O11Y } from 'components/interfaces/Settings/Logs' export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[] => { const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP @@ -139,18 +140,22 @@ export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[ }, ] : []), - { - key: 'logs', - label: 'Logs', - icon: , - link: - ref && - (isProjectPaused - ? homeUrl - : isProjectBuilding - ? buildingUrl - : `/project/${ref}/logs/explorer`), - }, + ...(SHOW_O11Y + ? [ + { + key: 'logs', + label: 'Logs', + icon: , + link: + ref && + (isProjectPaused + ? homeUrl + : isProjectBuilding + ? buildingUrl + : `/project/${ref}/logs/explorer`), + }, + ] + : []), { key: 'api', label: 'API Docs',