Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions apps/cms/.eslintrc.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions apps/cms/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { defineConfig } = require('eslint/config')
const supabaseConfig = require('eslint-config-supabase/next')

module.exports = defineConfig([supabaseConfig])
2 changes: 1 addition & 1 deletion apps/cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
"generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
"lint": "eslint .",
"migrate": "cross-env NODE_OPTIONS=--no-deprecation tsx scripts/migrate.ts",
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
Expand Down
3 changes: 0 additions & 3 deletions apps/design-system/.eslintrc.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions apps/design-system/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { defineConfig } = require('eslint/config')
const supabaseConfig = require('eslint-config-supabase/next')

module.exports = defineConfig([supabaseConfig])
2 changes: 1 addition & 1 deletion apps/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "pnpm run content:build && pnpm run build:registry && next build --turbopack",
"build:registry": "tsx --tsconfig ./tsconfig.scripts.json ./scripts/build-registry.mts && prettier --log-level silent --write \"registry/**/*.{ts,tsx,mdx}\" --cache",
"start": "next start",
"lint": "next lint",
"lint": "eslint .",
"content:dev": "contentlayer2 dev",
"content:build": "contentlayer2 build",
"clean": "rimraf node_modules .next .turbo",
Expand Down
3 changes: 0 additions & 3 deletions apps/docs/.eslintrc.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions apps/docs/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { defineConfig } = require('eslint/config')
const supabaseConfig = require('eslint-config-supabase/next')

module.exports = defineConfig([supabaseConfig])
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"embeddings:nimbus:refresh": "ENABLED_FEATURES_OVERRIDE_DISABLE_ALL=true pnpm run embeddings:refresh",
"last-changed": "tsx scripts/last-changed.ts",
"last-changed:reset": "pnpm run last-changed -- --reset",
"lint": "next lint",
"lint": "eslint .",
"lint:mdx": "supa-mdx-lint content --config ../../supa-mdx-lint.config.toml",
"postbuild": "pnpm run build:sitemap && pnpm run build:llms && ./../../scripts/upload-static-assets.sh",
"prebuild": "pnpm run codegen:graphql && pnpm run codegen:references && pnpm run codegen:examples",
Expand Down
3 changes: 3 additions & 0 deletions apps/docs/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"NEXT_PUBLIC_SENTRY_DSN",
"NEXT_PUBLIC_VERCEL_ENV",
"NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA",
"VERCEL",
"VERCEL_ENV",
"VERCEL_GIT_COMMIT_SHA",
// These envs are used in the packages
"NEXT_PUBLIC_STORAGE_KEY",
"NEXT_PUBLIC_AUTH_DEBUG_KEY",
Expand Down
10 changes: 0 additions & 10 deletions apps/studio/.eslintrc.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const TemplateEditor = ({ template }: TemplateEditorProps) => {
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false)
const [isSavingTemplate, setIsSavingTemplate] = useState(false)

// eslint-disable-next-line react-hooks/exhaustive-deps
const spamRules = (validationResult?.rules ?? []).filter((rule) => rule.score > 0)
const preventSaveFromSpamCheck = builtInSMTP && spamRules.length > 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const SpendCapSidePanel = () => {
if (visible && subscription !== undefined) {
setSelectedOption(isSpendCapOn ? 'on' : 'off')
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible, isLoading, subscription, isSpendCapOn])

const onConfirm = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ export const Usage = () => {
setSelectedProjectRefInputValue(projectRef)
}
// [Joshen] Since we're already looking at isSuccess
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [projectRef, isSuccessProjectDetail])

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-ex
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { DOCS_URL } from 'lib/constants'
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'
import { Markdown } from '../Markdown'
import { Markdown } from '../../Markdown'
import { getIndexAdvisorExtensions } from './index-advisor.utils'

export const IndexAdvisorDisabledState = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
WarningIcon,
} from 'ui'
import { IndexImprovementText } from './IndexImprovementText'
import { QueryPanelScoreSection } from './QueryPanel'
import { useIndexInvalidation } from './hooks/useIndexInvalidation'
import { QueryPanelScoreSection } from '../QueryPanel'
import { useIndexInvalidation } from '../hooks/useIndexInvalidation'
import { createIndexes } from './index-advisor.utils'

interface IndexSuggestionIconProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function createIndexes({
* @returns Whether there are index recommendations available
*/
export function hasIndexRecommendations(
result: GetIndexAdvisorResultResponse | undefined,
result: GetIndexAdvisorResultResponse | undefined | null,
isSuccess: boolean
): boolean {
return Boolean(isSuccess && result?.index_statements && result.index_statements.length > 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Lightbulb, ChevronsUpDown, Expand } from 'lucide-react'
import { Lightbulb, ChevronsUpDown } from 'lucide-react'
import { useEffect, useState } from 'react'
import dynamic from 'next/dynamic'
import dayjs from 'dayjs'

import { formatSql } from 'lib/formatSql'
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button, cn } from 'ui'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { QueryPanelContainer, QueryPanelSection } from './QueryPanel'
import {
QUERY_PERFORMANCE_COLUMNS,
Expand Down Expand Up @@ -170,7 +168,7 @@ export const QueryDetail = ({ selectedRow, onClickViewSuggestion }: QueryDetailP
return (
<li key={x.id} className="flex justify-between pt-3 text-sm">
<p className="text-foreground-light">{x.name}</p>
{typeof rawValue === 'string' ? (
{typeof rawValue === 'string' || typeof rawValue === 'number' ? (
<p
className={cn(
cacheHitRateToNumber(rawValue).toFixed(2) === '0.00' &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ import {
cn,
} from 'ui'
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
import { IndexAdvisorDisabledState } from './IndexAdvisorDisabledState'
import { IndexImprovementText } from './IndexImprovementText'
import { IndexAdvisorDisabledState } from './IndexAdvisor/IndexAdvisorDisabledState'
import { IndexImprovementText } from './IndexAdvisor/IndexImprovementText'
import { QueryPanelContainer, QueryPanelScoreSection, QueryPanelSection } from './QueryPanel'
import { useIndexInvalidation } from './hooks/useIndexInvalidation'
import { calculateImprovement, createIndexes, hasIndexRecommendations } from './index-advisor.utils'
import {
calculateImprovement,
createIndexes,
hasIndexRecommendations,
} from './IndexAdvisor/index-advisor.utils'

interface QueryIndexesProps {
selectedRow: any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,66 @@ export const QUERY_PERFORMANCE_ROLE_DESCRIPTION = [
'PgBouncer is a lightweight connection pooler for PostgreSQL. Available on paid plans only.',
},
] as const

export const QUERY_PERFORMANCE_CHART_TABS = [
{
id: 'query_latency',
label: 'Query latency',
},
{
id: 'rows_read',
label: 'Rows read',
},
{
id: 'calls',
label: 'Calls',
},
{
id: 'cache_hits',
label: 'Cache hits',
},
]

export const QUERY_PERFORMANCE_TIME_RANGES = [
{
id: 'last_60_minutes',
label: 'Last 60 minutes',
},
{
id: 'last_3_hours',
label: 'Last 3 hours',
},
{
id: 'last_24_hours',
label: 'Last 24 hours',
},
]

export const getPgStatMonitorLogsQuery = (startTime: string, endTime: string) =>
`
select
id,
pgl.timestamp as timestamp,
'postgres' as log_type,
CAST(pgl_parsed.sql_state_code AS STRING) as status,
CASE
WHEN pgl_parsed.error_severity = 'LOG' THEN 'success'
WHEN pgl_parsed.error_severity = 'WARNING' THEN 'warning'
WHEN pgl_parsed.error_severity = 'FATAL' THEN 'error'
WHEN pgl_parsed.error_severity = 'ERROR' THEN 'error'
ELSE null
END as level,
event_message as event_message
from postgres_logs as pgl
cross join unnest(pgl.metadata) as pgl_metadata
cross join unnest(pgl_metadata.parsed) as pgl_parsed
WHERE pgl.event_message LIKE '%[pg_stat_monitor]%'
AND pgl.timestamp >= CAST('${startTime}' AS TIMESTAMP)
AND pgl.timestamp <= CAST('${endTime}' AS TIMESTAMP)
ORDER BY timestamp DESC
`.trim()

export const PG_STAT_MONITOR_LOGS_QUERY = getPgStatMonitorLogsQuery(
new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
new Date().toISOString()
)
Loading
Loading