Skip to content
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

logging/logadmin - no way to set PageSize or PageToken when getting entries #10083

Closed
pkpfr opened this issue May 2, 2024 · 4 comments
Closed
Assignees
Labels
api: logging Issues related to the Cloud Logging API. triage me I really want to be triaged.

Comments

@pkpfr
Copy link

pkpfr commented May 2, 2024

It is currently not possible to set the PageSize or PageToken when using the admin client to get log entries.

Methods should be added to set EntryOptions for these two values, or if they can be set in the filter, there should be clear documentation on how to do so. The Iterator also has no method to set pagination.

Currently, the package is not fit for purpose. The timestamp filters only allow second precision. Logs could be missed or duplicated if using a timestamp for pagination purposes, and excessive may be transmitted due to not being able to restrict the page size.

@pkpfr pkpfr added the triage me I really want to be triaged. label May 2, 2024
@product-auto-label product-auto-label bot added the api: logging Issues related to the Cloud Logging API. label May 2, 2024
@gkevinzheng
Copy link
Contributor

gkevinzheng commented May 6, 2024

@pkpfr What method requiring EntriesOptions are you using? It looks like there is a way to set PageSize

// PageSize provide a way to override number of results to return from each request.
func PageSize(p int32) EntriesOption { return pageSize(p) }
type pageSize int32
func (p pageSize) set(r *logpb.ListLogEntriesRequest) { r.PageSize = int32(p) }

@gkevinzheng
Copy link
Contributor

@pkpfr Also to address your concern about the timestamp filters only allowing second precision, the Cloud Logging query language does allow you to enter timestamps with nanosecond accuracy: https://cloud.google.com/logging/docs/view/logging-query-language

In Go, you can format a Time object with RFC3339Nano to include nanoseconds into the passed in timestamp instead of RFC3339.

@pkpfr
Copy link
Author

pkpfr commented May 9, 2024

Thanks - my issue seems to be that this code hasn't been released in the current publicly available versions. cloud.google.com/go/logging v1.9.0.

@gkevinzheng
Copy link
Contributor

@pkpfr I've cut a release for logging: https://github.com/googleapis/google-cloud-go/releases/tag/logging/v1.10.0 that has the pageSize changes in them. Hope this resolves your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants