Draft
Conversation
adityathebe
commented
Jun 12, 2025
Comment on lines
+285
to
+286
| // https://stackoverflow.com/questions/76765079/v2-entriestail-always-returns-invalid-argument | ||
| // https: //cloud.google.com/logging/docs/reference/v2/rest/v2/entries/tail?apix=true&apix_params=%7B%22resource%22%3A%5B%7B%22resourceNames%22%3A%5B%22projects%2Fworkload-prod-eu-02%22%5D%7D%5D%7D#Reason |
Member
Author
There was a problem hiding this comment.
Tail API returns Bad Request for some reason
There was a problem hiding this comment.
Pull Request Overview
Adds support for streaming GCP Cloud Logging entries and scaffolding for end-to-end tests.
- Introduce
StreamRequest,StreamItem, andStreammethod ingcpcloudloggingfor tailing logs. - Update
Newto initialize both admin and service clients vialoggingapi. - Add a pending E2E test for streaming logs and adjust suite setup to skip dummy data.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/e2e/suite_test.go | Pass WithoutDummyData option to BeforeSuite setup. |
| tests/e2e/gcp_test.go | Add pending GCP log-streaming test (TODO cleanup commented code). |
| logs/gcpcloudlogging/cloud_logging.go | Implement Stream, define streaming types, update New API. |
| logs/gcpcloudlogging/zz_generated.deepcopy.go | Auto-generated DeepCopy for StreamRequest. |
Comments suppressed due to low confidence (3)
logs/gcpcloudlogging/cloud_logging.go:238
- [nitpick] Inconsistent context usage:
NewandSearchusedutycxt.ContextbutStreamacceptscontext.Context. For consistency and to leverage dutycxt features, consider aligning all methods to use the same context type.
func (gcp *cloudLogging) Stream(ctx context.Context, request StreamRequest) (<-chan StreamItem, error) {
logs/gcpcloudlogging/cloud_logging.go:38
- [nitpick] Public types and methods (
StreamRequest,StreamItem, andStream) lack top-level doc comments. Add GoDoc comments to explain their purpose and usage.
type StreamRequest struct {
logs/gcpcloudlogging/cloud_logging.go:270
- The
maxfunction is undefined here, causing a compile error. Implement a helper (e.g.,func max(a, b int) int) or inline the comparison to choose betweenrequest.BufferWindowand 1.
ticker := time.NewTicker(time.Duration(max(request.BufferWindow, 1)) * time.Millisecond)
Comment on lines
+259
to
+261
| req.BufferWindow = fmt.Sprintf("%d", request.BufferWindow*1000) | ||
| } else { | ||
| req.BufferWindow = "2000" |
There was a problem hiding this comment.
There’s a unit mismatch: BufferWindow is documented as seconds but is used both to set milliseconds in the API request and as milliseconds for the ticker. Clarify units or convert consistently.
Suggested change
| req.BufferWindow = fmt.Sprintf("%d", request.BufferWindow*1000) | |
| } else { | |
| req.BufferWindow = "2000" | |
| req.BufferWindow = fmt.Sprintf("%d", request.BufferWindow*1000) // Convert seconds to milliseconds | |
| } else { | |
| req.BufferWindow = fmt.Sprintf("%d", 2*1000) // Default to 2 seconds, converted to milliseconds |
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.
No description provided.