google-cloud-go icon indicating copy to clipboard operation
google-cloud-go copied to clipboard

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

Open pkpfr opened this issue 9 months ago • 4 comments

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 avatar May 02 '24 05:05 pkpfr

@pkpfr What method requiring EntriesOptions are you using? It looks like there is a way to set PageSizehttps://github.com/googleapis/google-cloud-go/blob/0183dd57dbc12b307ca185da33158dedebe1acf2/logging/logadmin/logadmin.go#L225-L230

gkevinzheng avatar May 06 '24 14:05 gkevinzheng

@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.

gkevinzheng avatar May 09 '24 15:05 gkevinzheng

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.

pkpfr avatar May 09 '24 15:05 pkpfr

@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.

gkevinzheng avatar May 15 '24 20:05 gkevinzheng

Unfortunately, setting the pageSize seems to have no effect. No matter what the value is set to, it is ignored.

pkpfr avatar May 30 '24 05:05 pkpfr