mirror of
https://github.com/supabase/supabase.git
synced 2026-06-21 05:46:00 +08:00
Add a Query Performance page implementation powered by [supamonitor](https://github.com/supabase/supamonitor). [Context](https://linear.app/supabase/project/build-extension-for-supabase-query-insights-df4fb145352c/overview) This looks largely the same as the pg_stat_monitor implementation: <img width="2556" height="960" alt="Screenshot 2026-02-12 at 7 35 47 PM" src="https://github.com/user-attachments/assets/bf37466e-f7af-41f2-b4f2-cf8eb6a8c76f" /> Only available on projects on custom AMI - existing users are unaffected <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Supamonitor-based query performance view: charts, aggregated metrics, date-range controls, and export/download. * Added "Application" column for per-application tracking. * Interactive Supamonitor grid: sorting, filtering, keyboard navigation, selection, retry/error handling. * Automatic per-project Supamonitor detection with toggleable UI integration. * **Bug Fixes** * Chart latency calculation prefers histogram data for more accurate p95. * **Documentation** * Minor blog formatting fix. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: kemal <hello@kemal.earth> Co-authored-by: Ali Waseem <waseema393@gmail.com>
25 lines
769 B
TypeScript
25 lines
769 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { formatDuration } from './QueryPerformance.utils'
|
|
|
|
describe('formatDuration', () => {
|
|
it('should format seconds', () => {
|
|
expect(formatDuration(1000)).toBe('1.00s')
|
|
expect(formatDuration(30000)).toBe('30.00s')
|
|
})
|
|
|
|
it('should format minutes and seconds', () => {
|
|
expect(formatDuration(60000)).toBe('1m')
|
|
expect(formatDuration(125000)).toBe('2m 5s')
|
|
})
|
|
|
|
it('should format hours, minutes and seconds', () => {
|
|
expect(formatDuration(3600000)).toBe('1h')
|
|
expect(formatDuration(3661000)).toBe('1h 1m 1s')
|
|
})
|
|
|
|
it('should format days, hours, minutes and seconds', () => {
|
|
expect(formatDuration(86400000)).toBe('1d')
|
|
expect(formatDuration(90061000)).toBe('1d 1h 1m 1s')
|
|
})
|
|
})
|