-
Notifications
You must be signed in to change notification settings - Fork 298
Feat: Logs Frontend, Part III #2888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR wires task retry/attempt context through the Python SDK, ingestion pipeline, and frontend so logs can be filtered by attempt number and display the correct attempt metadata.
Changes:
- Propagates
retry_countfrom worker actions into a newctx_task_retry_countcontext var and includes it when emitting logs via the Python SDK, sendingtaskRetryCountin the events protocol and storing it asretry_countonv1_log_line. - Extends the log listing API (OpenAPI spec, server handler, repository, and SQL) to accept an
attemptquery parameter that filters logs by attempt number (user-facing 1-based attempt mapped to 0-basedretry_count). - Updates the frontend log search (parser, autocomplete, query wiring, and UI) to support
attempt:filters, display attempts per log line, and provide attempt-aware autocomplete based on the task’s retry count.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sdks/python/pyproject.toml | Bumps Python SDK version to 1.22.13 for the new logging/attempt functionality. |
| sdks/python/hatchet_sdk/worker/runner/utils/capture_logs.py | Adds ctx_task_retry_count handling, a typed context-var union, and includes task_retry_count in async log sending and forwarded log records. |
| sdks/python/hatchet_sdk/worker/runner/runner.py | Sets ctx_task_retry_count in async_wrapped_action_func, but currently does not copy it into the thread pool context for sync tasks (see comment). |
| sdks/python/hatchet_sdk/worker/action_listener_process.py | Sets ctx_task_retry_count when starting the action loop so worker-side logs know which attempt they belong to. |
| sdks/python/hatchet_sdk/runnables/contextvars.py | Introduces the ctx_task_retry_count context variable with a default of 0. |
| sdks/python/hatchet_sdk/context/context.py | Ensures context-based log() calls publish a LogRecord carrying the current retry_count to be sent as taskRetryCount. |
| sdks/python/hatchet_sdk/clients/events.py | Extends EventClient.log to accept an optional task_retry_count and forwards it on the PutLogRequest as taskRetryCount. |
| sdks/python/CHANGELOG.md | Documents version 1.22.13 and the new task_retry_count logging behavior for frontend filtering. |
| pkg/repository/sqlcv1/log_line.sql.go | Adds an Attempt parameter and wires it into the ListLogLines SQL call/placeholder sequence. |
| pkg/repository/sqlcv1/log_line.sql | Adds an attempt named argument and filters v1_log_line.retry_count = attempt - 1 to align 1-based attempts with 0-based retry counts. |
| pkg/repository/log_line.go | Extends ListLogsOpts with Attempt and passes it through to the generated SQL params when present. |
| pkg/client/rest/gen.go | Extends V1LogLineListParams and the NewV1LogLineListRequest builder to support an attempt query parameter. |
| frontend/app/src/lib/api/generated/Api.ts | Updates the generated v1LogLineList client method to accept an optional attempt number in its query object. |
| frontend/app/src/components/v1/cloud/logging/log-search/use-logs.tsx | Adds attempt-aware parsing, query keys, API query parameters, log shaping (surfacing row.attempt), and computes availableAttempts from the task’s retryCount. |
| frontend/app/src/components/v1/cloud/logging/log-search/types.ts | Extends ParsedLogQuery with an attempt field. |
| frontend/app/src/components/v1/cloud/logging/log-search/parser.ts | Parses attempt:<n> tokens, validates positive integers, and surfaces them in ParsedLogQuery. |
| frontend/app/src/components/v1/cloud/logging/log-search/log-search-input.tsx | Integrates availableAttempts into autocomplete, refines suggestion application behavior, and adds chips for level: and attempt: filters. |
| frontend/app/src/components/v1/cloud/logging/log-search/autocomplete.ts | Generalizes autocomplete to support multiple filter keys and value suggestions for attempts based on availableAttempts. |
| api/v1/server/oas/gen/openapi.gen.go | Regenerates the OpenAPI server bindings to include the attempt query parameter on V1LogLineList and handle binding/validation. |
| api/v1/server/handlers/v1/tasks/list_logs.go | Plumbs the optional attempt query parameter into ListLogsOpts so repository calls can filter logs by attempt. |
| api-contracts/openapi/paths/v1/tasks/tasks.yaml | Updates the OpenAPI path definition for /tasks/{task}/logs to document the new integer attempt query parameter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* fix: don't toggle selection if a user is dragging * fix: command selection state * fix: close search bar on enter * fix: improve search bar styling a bit, make it more consistent with designs * chore: tsc * Feat: Logs Frontend, Part III (#2888) * fix: propagate retry count through properly * feat: attempt switcher * fix: attempt numbers * feat: add attempt param to log query * feat: wiring * feat: attempt filter * chore: changelog * fix: use the button component * fix: only close on enter when in FTS mode * fix: pass retry count and log level in Go * fix: feedback * chore: lint * fix: rm cruft comment
Description
Wiring up attempt filtering + sending retry counts from the Python SDK
Type of change