mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
create-pull-request/patch
13
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4fa8afe918 | feat(studio): support grouped OR filters in unified logs (#53943) | ||
|
|
8bebf8206e |
fix(logs): retain loaded history on refresh DEBUG-233 (#51598)
Preserve loaded log history during refresh, bound refresh requests, and stop automatic polling when Live is paused. |
||
|
|
7867f22522 |
feat(studio): link log users and show Auth activity timelines (#50837)
Add a User tab that resolves the signed-in user from the selected log or a related request step. It shows the shared Auth profile, offers filtering from the User ID row, and explains anonymous, external, or deleted users. When unified logs are enabled, the Auth user's Logs tab shows the user's 10 most recent logs in `EmbeddedLogsTable`, with the Logs page's columns and row styling. A row opens that log on the Logs page, filtered to the user, and View more in Logs opens the rest. Other configurations retain the existing Logs view. Shared user presentation is isolated in #50841; this PR contains the log/Auth integration and resolves missing-user queries to null. The list uses the #50953 helpers instead of its own: `createUnifiedLogsSearch` builds the query search, `buildUnifiedLogsUrl` builds the links (it now takes a `logId` to open a log), and the query asks for only the 10 rows it shows via `pageSize`. At the panel's default width the table is wider than the panel, so Event message needs a horizontal scroll; the empty state renders outside the table so it stays in view. Issue: [DEBUG-222](https://linear.app/supabase/issue/DEBUG-222/build-correlated-log-and-user-connections-in-studio) ### How to test 1. With the Unified Logs preview and `otelUnifiedLogs` enabled, open a signed-in user's log and select User. Check the profile, copy the User ID, and use Add filter to filter logs to that user. 2. Use Open in Authentication, then open the user's Logs tab. Select a row and confirm it opens the matching log; check that View more in Logs preserves the user filter. 3. Open an anonymous request and confirm the explanatory state. For correlated, external, and deleted-user cases, run the fixtures: `pnpm --filter studio exec vitest run components/interfaces/UnifiedLogs/components/LogUser.platform.test.tsx`. 4. In the log's User tab, focus User ID and press Enter, Arrow Down, Enter. Confirm it copies the ID without changing the selected log. Arrow Down should navigate logs again after the menu closes. ### Validation - Latest head: `8e4a9993b0db52ec5e611e55233b5ed77f67e358`, based on `master`, with conflicts resolved and independent review complete. - Local baseline and shuffled verification passed 324 tests across 26 files with retries disabled (shuffle seed `5083710`). An independent affected-suite run passed 29 tests with retries disabled and shuffle seed `5083730`. - Live QA found and reproduced a keyboard collision: field-menu Arrow Down also selected the next log. The shared menu now keeps keyboard events inside the menu. The regression fails when the guard is removed and passes after restoration. - On the verified latest-head preview, keyboard User ID copy, mouse copy, Add filter, Escape, navigation after closing the menu, and adjacent Auth email copying passed. No browser console errors were observed; browser network telemetry was unavailable. - Full signed-in activity, matching log/profile, Authentication navigation, View more filtering, anonymous state and deleted-user handling passed on `311206f9ef`. The subsequent change only affects menu keyboard propagation, which was revalidated on the latest head. - The disposable staging user was deleted and absence verified. Temporary key files were removed and the clipboard cleared. - Current CI: all E2E suites, unit tests, formatting, lint, Docker and deployments passed; typecheck is still running. Local full typecheck exhausted Node's heap, so no local full pass is claimed. ### Stack All prerequisite log-decoupling and request-correlation PRs, including #50841, are merged into `master`. This is the final code PR in the stack. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
7f7ebf527b |
feat(studio): use shared logs table for recent function errors (#50958)
The Overview's "Errors in the last 24h" section now uses the Logs tab's queries (#50954) and the read-only `EmbeddedLogsTable` (#50953) instead of its own SQL and table. It previews the latest five errors since the last deploy, capped at 24h, shows "+N more" when there are more and links to the rest. It's behind the `edgeFunctionsOverview` flag, like the rest of the new Overview. - Rows have no multi-select checkbox. Clicking one opens it in the Logs tab with the same range and error filter, and "View logs" and "+N more" open the filtered list. - With the unified logs preview off, those links open the pre-unified Invocations tab (for invocation rows) or Logs tab (for runtime rows), using those tabs' own `its`/`ite`/`log` params. - "Explain with AI" and "Copy summary" send the previewed errors to the Assistant with the same prompt as selected logs on the Logs page. The prompt also notes how many errors were left out. - One count query, scoped to the function and unfiltered, gives both the error count behind "+N more" and the invocations since the deploy, from its level and log type facets. It replaces the hand-built invocation count SQL, so the section runs two queries instead of three. - The row query fetches only the five errors shown, through a new `pageSize` option on `useUnifiedLogsInfiniteQuery`. - The section uses the edge function preset from #50957, so it runs the Logs tab's scoped queries and shares its saved columns. - The custom error grouping and its SQL are removed. Net, the PR removes about 390 lines. ### How to test 1. With `edgeFunctionsOverview` on, open a function that has recent errors. You should see up to five rows without checkboxes, and "+N more" when there are more. 2. Click a row with the unified logs preview on. It opens the Logs tab with that log selected. Turn the preview off and click an invocation row and a runtime row. They open Invocations and Logs respectively. 3. Use Explain with AI and Copy summary and check the prompt. 4. For a function with no errors since the last deploy, the section shows the invocation count instead. ### Validation - MSW component tests: preview rows and "+N more", no checkboxes, the summary prompt, row links with the preview on and off, and the no-errors state. They also check the row query asks for five rows and that a single unfiltered count runs. `pageSize` and the facet count helper have unit tests. - Studio typecheck, lint ratchet, Prettier and knip pass on this layer. ### Stack Merge in order: 1. #50953 — reusable logs table building blocks 2. #50954 — function-scoped unified logs queries 3. #50955 — slimmer function detail layout, header on Overview 4. #50957 — Invocations merged into a function-scoped Logs tab 5. #50958 — Overview errors in the shared logs table 6. #52281 — remove the legacy Overview --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
973dfa1b97 |
feat(studio): scope unified logs queries to one edge function (#50954)
Adds an optional `scope` to the unified logs search: fixed filters every query applies on top of the user's, which the user can't remove. Nothing sets a scope in this PR, so the Logs page is unchanged. #50957 uses one to narrow the function Logs tab to one edge function. A scope uses the same columns and operators as the `filter` URL param, so any view can narrow logs to one resource without new query code. Columns the query builder doesn't know match a `log_attributes` key, so one edge function's logs are: ```ts { filters: [ { column: 'log_type', operator: '=', value: 'edge function' }, { column: 'log_type', operator: '=', value: 'edge function runtime' }, { column: 'function_id', operator: '=', value: functionId }, ], } ``` - New `edge function runtime` log type, read from the `function_logs` source. Its level comes from the console level (`error`/`fatal` count as errors, `warn`/`warning` as warnings), and its details stay in metadata. - **Every scan**: the scope's filters apply to rows, counts, the chart and single-facet queries. Facet scans never drop them, unlike the user's own filter on the facet's column. Filters on the same column and operator combine like the URL's (`=` values match any), every group must match, and a scope replaces the default postgres + edge log types. - **Fails closed**: a scope condition that can't be built matches no rows, instead of being dropped like a bad user filter. - **ClickHouse only**: scoped searches always run on ClickHouse, whatever `otelUnifiedLogs` says, including downloads and the log detail panel. The BigQuery queries are unchanged from master and throw on a scope rather than return rows from outside it. - `getLogTypeVisibility` offers only the log types a scope fixes. Otherwise it keeps the new log type out of the filters, since the project-wide Logs page already shows runtime logs inside each invocation's detail panel. - `toQuerySearchParams` and `createUnifiedLogsSearch` attach the scope. - `UnifiedLogs` works out which log types its queries may use once, instead of in each of its queries, filters and facets. ### How to test 1. Open the project Logs page with the unified logs preview on. The log type filter shouldn't offer "Edge Function runtime", and default results should match master. 2. The scoped behavior is easiest to try on #50957. ### Validation - Query builder tests: the scope on every count scan, the chart and facet queries, requests for out-of-scope log types, different operators on one column, the fail-closed case, BigQuery refusing a scope, and unscoped queries staying the same. - Studio typecheck, lint ratchet, Prettier and knip pass on this layer. ### Stack Merge in order: 1. #50953 — reusable logs table building blocks 2. #50954 — function-scoped unified logs queries 3. #50955 — slimmer function detail layout, header on Overview 4. #50957 — Invocations merged into a function-scoped Logs tab 5. #50958 — Overview errors in the shared logs table 6. #52281 — remove the legacy Overview --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
bc9bee459f |
refactor(studio): extract reusable logs table building blocks (#50953)
Extract shared logs tables and query helpers. Validate query parameters and preserve defaults, keep custom preview footers independent of pagination, and cover preview behavior and omitted log counts. |
||
|
|
60b51d74d5 |
Audit existing unit tests + Remove redundant ones (#52215)
## Context
_TLDR: Changes here speeds up unit tests on CI from ~14 minutes to ~3
minutes_ 😂
_TLDR 2: The file changes are solely only test files +
`studio-unit-tests.yml`_
We've currently got a lot of unit tests in the repository which while
great for coverage, hasn't been ideally written. There's a lot of
redundancy + overly specific tests that break easily, and our current
unit test takes about 15 minutes to run in the GHA per PR. Hence am
doing a audit clean up of all existing unit tests in the studio repo.
## Changes involved
- `.test.ts` files now run in `node`, `.test.tsx` in `jsdom`
- jsdom costs about 1s of setup per file. A `.ts` test that needs the
DOM opts in with `// @vitest-environment jsdom` (46 files do).
- Removed redundant and over-specific tests
- Duplicates are merged into `test.each`. Tests that only covered
libraries, existed for coverage, or asserted class names and snapshots
are deleted. 19 files are merged into a sibling or deleted.
- Fixed about 15 tests that couldn't fail
- Examples: unawaited assertions, fixtures equal to the default, and a
`semverGte` test calling `semverLte`.
- Sped up the slowest files
- Real sleeps are replaced with fake timers, `user.type` with paste, and
Radix option queries are scoped to the open listbox. For example,
`RestoringState` went from 18s to 0.3s and
`useTableEditorFiltersSort.navigation` from 20s to 3s.
- These ^ already shave down the unit tests time from 14 mins to 9 mins,
but am also sharding unit tests across 4 jobs to increase speed up
further which then shaves down time to 3 mins now
|
||
|
|
29878860a9 |
fix(compute): filter logs on the subservice attribute (#50562)
## Problem Compute log rows are filtered on `log_attributes['source']`, the deprecated twin of the top-level `subservice` the log writer now publishes. FUNC-894 deletes the twin from the writer, which would leave the per-instance log tabs and the Unified Logs `compute` type matching nothing — silently, since a missing attribute key returns no rows rather than an error. ## Fix Read the stream from `log_attributes['subservice']` instead. Both keys carry the same value on every row today, so this is a same-behaviour switch that lets the twin be removed. It stays a `log_attributes` lookup rather than a bare `subservice` column: the unified logs mapping does not classify these rows, so `source` is empty on a compute row and every key the backend publishes lands in the attribute map. A bare `subservice` predicate fails the whole query with `Field "subservice" does not exist`. - `COMPUTE_LOG_SUBSERVICES` replaces `WORKER_LOG_SOURCES`; the values keep their pre-rename `worker_*` spelling, which is still what the backend publishes - `STREAM_KEY` in `compute-instance-logs-query.ts` and the Unified Logs condition used by the log-type, status, method, pathname, metadata and level expressions both move to the new key - row fixtures in the three utils test files carry `subservice` instead of `source`, so they match the wire shape that survives FUNC-894 Supersedes #50219, which targets a `subservice` column and a `source = 'worker_logs'` mapping that do not exist yet; that shape becomes the follow-up if the mapping ships. Relates to [FE-4358](https://linear.app/supabase/issue/FE-4358). ## How to test - Open a compute instance's Invocations, Logs, and Activity tabs — each shows only its own stream, and message filtering still narrows within it. - In Unified Logs, include and then exclude the Compute log type; rows, counts, and charts move together, and compute rows keep their metadata while status, method, and pathname stay null. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Compute logs are now identified and filtered using subservice metadata in unified logs and compute instance logs. - Compute log classification and display now handle compute-specific fields and severity consistently. - Guest and ingress compute streams now use subservice metadata for more consistent results across supported log views. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
e296d0ae4f |
Joshenlim/fe 4373 add ilike comparator for pathname in unified logs (#50386)
## Context In unified logs, filtering on pathname can benefit using the `ilike` comparator so this PR adds support for that <img width="423" height="247" alt="image" src="https://github.com/user-attachments/assets/31e5f09b-7506-4588-90e3-ee705f805d43" /> FilterBar is also updated to omit facet values if the selected comparator is `ilike`, otherwise it doesn't really make sense to show a dropdown of values for users to select as the value for `ilike` filtering. <img width="240" height="62" alt="image" src="https://github.com/user-attachments/assets/b5fc97e7-d826-4184-8b70-bfb4875d1822" /> The facet values should still show if the selected comparator is an equals comparator <img width="391" height="154" alt="image" src="https://github.com/user-attachments/assets/7ccded04-3db1-4406-af40-4377ffe3bd8d" /> Related to https://github.com/supabase/supabase/pull/50394 - am also updating ilike comparator logic for unified logs to implicitly wrap the provided string with `%`, but only if the string doesn't already contain a `%` or `_` for UX convenience. (Unified logs already had this behaviour, except the latter part RE omitting default `%` if string already has) - this affects pathname and event_message searching <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **New Features** * Added case-insensitive pathname filtering for logs with ILIKE and NOT ILIKE. * Added pathname support for comparison and pattern-matching operators. * Preserved user-provided `%` and `_` wildcard patterns in searches. * **Bug Fixes** * Corrected BigQuery pathname filtering for consistent case-insensitive matching. * Prevented misleading exact-value suggestions for pattern-based searches. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
0bf22ee6fc |
chore(studio): update product naming (#50208)
workers -> compute <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added the Compute experience for deploying, viewing, managing, and monitoring compute instances. - Added Compute navigation, instance detail pages, secrets, logs, deployment dialogs, generated snippets, and CLI commands. - Added filtering, status, availability, and data-loading support for compute instances. - **Updates** - Updated labels, icons, links, feature controls, unified logs, and secret-deletion messaging to use Compute terminology. - Compute routes now replace the previous Workers routes and pages. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
be030229bf |
feat(studio): add workers to unified logs FE-4281 (#49682)
## Problem Unified Logs does not expose Workers logs, so users cannot search Workers ingress, runtime, or build events alongside other services. ## Fix Add a Workers log type that classifies all three Workers OTEL streams. Gate the option and any persisted Workers filters with the existing Workers feature flag. ## How to test - Enable the Workers feature flag and open Unified Logs. - Select Workers from the Log Type filter. - Expected result: Unified Logs shows ingress, runtime, and build events with the Workers icon. - Disable the Workers feature flag and load a URL containing `log_type:eq:workers`. - Expected result: the Workers option and filter are removed, and Workers logs are not queried. - Run `./node_modules/.bin/vitest --run components/interfaces/UnifiedLogs/UnifiedLogs.queries.test.ts components/interfaces/UnifiedLogs/UnifiedLogs.utils.test.ts data/workers/worker-logs-query.test.ts` from `apps/studio`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Workers as a selectable log type in Unified Logs. * Unified Logs now combines worker ingress, guest, and API streams under the Workers category. * Added a dedicated Workers icon and worker log filtering. * **Improvements** * Worker filters and URL parameters respect feature availability. * Worker details show relevant metadata while omitting unavailable HTTP fields. * Improved handling of worker log levels, statuses, and raw data. * Added stronger validation for unified log data. * **Tests** * Added coverage for worker routing, filtering, feature visibility, parsing, and metadata redaction. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
17ee3e6977 |
feat(studio): add Multigres log type to unified logs FE-3785 (#47560)
## 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> |
||
|
|
91d70a8c38 |
feat(studio): chart bar links open unified logs when enabled (#47502)
## What When the unified logs preview is enabled, clicking a chart bar that links to a logs view now opens **unified logs** (scoped to the service and time bucket) instead of the legacy logs explorer. Surfaces updated: - Homepage project usage charts (`ProjectUsageSectionDeltas`, `ProjectUsageSection`) - Observability overview service health table (`ObservabilityOverview`) — also fixes the API Gateway row and passes the time range via the `date` param unified logs actually reads Adds a small `buildUnifiedLogsUrl` helper so the deep-link format (`filter=log_type:eq:<type>` + `date` epoch-ms range) lives in one place. When the preview is off, behavior is unchanged (legacy logs explorer). Resolves O11Y-2133. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added unified logs navigation for project usage and observability charts. * Chart bar clicks now open the unified logs view with service-specific filtering and a computed time window. * **Bug Fixes** * Updated observability and usage charts to generate the correct unified logs URLs (including `log_type` filtering and optional date ranges). * Preserved legacy log navigation behavior when unified logs are disabled. * **Tests** * Added unit tests covering unified logs URL generation, query parameters, and date handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |