fix(logs): align CLI with log search APIs#8
Conversation
e5825dd to
012e86f
Compare
tkkhq
left a comment
There was a problem hiding this comment.
Inline findings with severity markers ([P0]=blocker … [P3]=low, nit=optional). Build + targeted go test pass locally. Note: GitHub shows a stale 42-file diff — the real change is one commit / 15 files on top of current main; recommend a rebase.
Behavioral note (not anchorable — removed code): function runtime logs lose the partial/region-error warning. This is correct (the regenerated LogSearchResponse/ListLogsResponse no longer carry partial/region_errors), but worth a release-note line so users know why the signal disappeared. [P3]
| redis: | ||
| condition: service_healthy | ||
| dynamodb: | ||
| condition: service_started |
There was a problem hiding this comment.
[P2] dynamodb gates the server on service_started, not service_healthy (postgres/redis use health). DynamoDB Local has no healthcheck here, so the server can boot before DynamoDB accepts connections. If the server doesn't retry table setup, a cold volcano start may flake. Either confirm the server retries, or add a simple healthcheck and switch to condition: service_healthy.
There was a problem hiding this comment.
Confirmed against the hosting change: local-mode startup calls EnsureFunctionLogDynamoDBTable before initializing the log store, and that helper retries for up to 60s while DynamoDB Local comes up. Since the upstream local-mode template uses service_started and the server-side retry covers cold startup, I left the dependency shape unchanged.
| REDIS_URL: redis://redis:6379 | ||
| DYNAMODB_ENDPOINT: http://dynamodb:8000 | ||
| FUNCTION_INVOCATIONS_TABLE_NAME: volcano-local-function-invocations | ||
| LOG_EVENTS_HOT_PATH_TABLE_NAME: volcano-local-log-events |
There was a problem hiding this comment.
[P2] These table names are configured but nothing in the Compose asset creates the tables — DynamoDB Local boots empty. Fine if the server auto-creates them in LOCAL_MODE; please confirm. This is the classic case that works on a warm volume and fails on a fresh volcano-dynamodb volume.
There was a problem hiding this comment.
Confirmed: in LOCAL_MODE, the hosting server auto-creates LOG_EVENTS_HOT_PATH_TABLE_NAME via EnsureFunctionLogDynamoDBTable and waits for the table to exist before continuing. I also removed the stale FUNCTION_INVOCATIONS_TABLE_NAME from this CLI asset, since hosting no longer reads that env var.
| return "" | ||
| // PrintSearchLogs renders paginated searched log events from fetch until the | ||
| // response signals no more pages or the cursor cannot be advanced. | ||
| func PrintSearchLogs(w io.Writer, fetch SearchLogsFetcher) error { |
There was a problem hiding this comment.
[P3] PrintSearchLogs is structurally identical to PrintLogs — only the event renderer and response type differ. Two copies of the pagination/stop logic will drift. Consider a small accessor interface + generics, or at minimum a // keep in sync with PrintLogs comment.
There was a problem hiding this comment.
Leaving this as-is for now. The duplicated pagination loops are small and tied to distinct generated response types/renderers; adding a generic abstraction here would make the CLI output path less direct for limited reuse. Both list and search paths have command coverage, so I would revisit if another log pagination variant appears.
| # auth_config points its smtp_host at "mailpit" so signup confirmations, | ||
| # password reset emails, etc. land in Mailpit's inbox at http://localhost:8025 | ||
| # instead of being discarded. | ||
| mailpit: |
There was a problem hiding this comment.
nit: Mailpit is added here but the PR summary only mentions DynamoDB. Since it's inherited from the upstream source template, add a line to the description so reviewers know the new SMTP catch-all is intentional.
There was a problem hiding this comment.
Updated the PR description to call out Mailpit explicitly as part of the refreshed upstream local-mode asset.
|
Follow-up on the review body notes: the PR history has been rebuilt on current |
tkkhq
left a comment
There was a problem hiding this comment.
Approving. All four review findings addressed:
- [P2] dynamodb
service_startedrace — covered by server-sideEnsureFunctionLogDynamoDBTableretry (up to 60s); no change needed. - [P2] log table creation — server auto-creates
LOG_EVENTS_HOT_PATH_TABLE_NAMEin LOCAL_MODE; staleFUNCTION_INVOCATIONS_TABLE_NAMEremoved in eecdcfe. - nit Mailpit — PR description updated.
- [P3] PrintLogs/PrintSearchLogs duplication — reasonable won't-fix.
Core log-search migration is clean, builds, and passes targeted tests. Optional follow-ups: rebase to collapse the stale 42-file diff, and a release-note line about the dropped partial-region warning.
Summary
POST /projects/{id}/logs/searchwithresource_type=function,resource_ids, and opaque cursor pagination.next_token/nextURLs to thecursor/next_cursorcontract.Architecture
volcano functions logs --type runtimenow reads the project log search API and rendersLogSearchResponseevents.cursorand advance fromnext_cursor.volcano startbrings up DynamoDB Local and configures the server withDYNAMODB_ENDPOINTandLOG_EVENTS_HOT_PATH_TABLE_NAMEso local mode can use the DynamoDB-backed hot log path.User-visible behavior
LogSearchResponseandListLogsResponseshapes no longer returnpartialorregion_errors.Related PRs
Validation
docker compose -f internal/localmode/assets/docker-compose.template.yml config --quietgo test ./...