mirror of
https://github.com/supabase/supabase.git
synced 2026-09-09 19:42:46 +08:00
## Problem The Multigres log type is available in the legacy logs collections but was missing from the new unified logs, so Multigres logs could not be selected or viewed there. ## Fix Wire the `multigres_logs` source into unified logs the same way the other single-source types (Realtime, Supavisor, PgBouncer) are: a display label, a filter condition, the derived `log_type` expression, a display-casing entry, and a sidebar icon. ## How to test - Open a project with Multigres logs and go to the new unified logs view - Open the Log Type filter and confirm "Multigres" appears as an option - Select "Multigres" and confirm rows from the `multigres_logs` source are returned and labeled "Multigres" with the network icon - Expected result: Multigres logs are filterable and display correctly, matching the legacy logs behavior ## Notes Level/severity uses the shared `severity_text` fallback that all non-HTTP sources rely on. If Multigres rows come back always classified as success, the OTEL pipeline may not populate `severity_text` for this source (legacy logs read the level from a JSON `event_message`), which would need a source-specific level branch. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for the **Multigres** log type in Unified Logs (labels, icon, and derived filtering/grouping/counting). * Unified Logs now renders Multigres **event_message** by extracting the `msg` field from valid JSON, with correct capitalization. * Unified Logs row click telemetry now recognizes **Multigres**. * The **Multigres** log type option is hidden when the selected project is not high-availability. * **Tests** * Added/updated unit tests for Multigres event-message parsing and shared event-message display behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
972 B
TypeScript
35 lines
972 B
TypeScript
import { renderHook } from '@testing-library/react'
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
import { useShowMultigresLogs } from '../useShowMultigresLogs'
|
|
|
|
const mockUseFlag = vi.fn()
|
|
|
|
vi.mock('common', async (importOriginal) => ({
|
|
...(await importOriginal<typeof import('common')>()),
|
|
useFlag: (name: string) => mockUseFlag(name),
|
|
}))
|
|
|
|
describe('useShowMultigresLogs', () => {
|
|
beforeEach(() => {
|
|
mockUseFlag.mockReset()
|
|
})
|
|
|
|
it('returns true when the showMultigresLogs flag is enabled', () => {
|
|
mockUseFlag.mockReturnValue(true)
|
|
|
|
const { result } = renderHook(() => useShowMultigresLogs())
|
|
|
|
expect(result.current).toBe(true)
|
|
expect(mockUseFlag).toHaveBeenCalledWith('showMultigresLogs')
|
|
})
|
|
|
|
it('returns false when the showMultigresLogs flag is disabled', () => {
|
|
mockUseFlag.mockReturnValue(false)
|
|
|
|
const { result } = renderHook(() => useShowMultigresLogs())
|
|
|
|
expect(result.current).toBe(false)
|
|
})
|
|
})
|