Add the GCP log import web flow - #38
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9b84bc9. Configure here.
| func newImportLogOutput(config ImportConfig, runID string) (*importLogOutput, error) { | ||
| fileName := config.Provider + "-" + runID + ".ndjson" | ||
| logPath := filepath.Join(config.Dir, "logs", fileName) | ||
| file, err := os.CreateTemp(filepath.Dir(logPath), "."+fileName+".*.tmp") |
There was a problem hiding this comment.
Import temps listed as logs
Low Severity
Streaming imports create a temporary NDJSON file under logs/ via CreateTemp, and ListLogFiles returns every file in that directory. While an import is running, that incomplete temp file can show up in the web Logs tab and in any flow that reads all files in logs/.
Reviewed by Cursor Bugbot for commit 9b84bc9. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem
Large Cloud Logging imports use too many read requests, and the complete import flow is not available in the browser.
Solution
Add the browser import flow and stream Cloud Logging entries with larger pages, quota retry, and atomic file writes.
Major Changes
Note
Medium Risk
Changes the GCP import path (new API client, streaming I/O) and adds user-facing import controls that rely on local ADC; failures are recorded on ImportRun but large pulls still touch external quotas and disk.
Overview
Browser GCP imports — New Imports tab with project/filter/limit, quick 1h/6h/24h ranges, recent query picker (cross-workspace), latest-run status, and history from ImportRun records. Starts imports via
createImportRunand pollsGetOperation(shared with discovery);hasActiveRunblocks uploads, log deletes, discovery, and workspace delete while an import or discovery operation is in flight.Streaming import pipeline —
ImportFetchernow takes anImportLineWriterinstead of returning in-memory lines.RunImportwrites NDJSON to a temp file underlogs/, enforces the entry cap during writes, and **rename**s only on success (zero entries leaves no file).Cloud Logging client —
gcplog.FetchLinesbecomesgcplog.Fetch, using Logging API v2ListLogEntrieswith up to 10,000 entries per page, 5m call timeout, and gax retry on quota/transient errors; entries are converted and passed to the writer as they arrive. CLI and web server fetchers are wired to the new signature.Reviewed by Cursor Bugbot for commit 9b84bc9. Bugbot is set up for automated code reviews on this repo. Configure here.