Skip to content

Conversation

@tseaver
Copy link
Contributor

@tseaver tseaver commented Mar 3, 2016

No description provided.

@tseaver tseaver added the api: logging Issues related to the Cloud Logging API. label Mar 3, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 3, 2016
@tseaver
Copy link
Contributor Author

tseaver commented Mar 7, 2016

@dhermes PTAL. I will rebase #1574 and assign to you after this one lands.

dt_str, _RFC3339_MICROS).replace(tzinfo=UTC)
except ValueError: # maybe nanosecond resoultion
prefix, suffix = dt_str.split('.')
fraction, zulu = suffix[:-1], suffix[-1]

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Mar 8, 2016

Sorry I've gotta stop midway through the review, have to go teach

@tseaver
Copy link
Contributor Author

tseaver commented Mar 9, 2016

@dhermes this one should be good to go.

:param resource: one entry resource from API response
:type loggers: dict or None
:param loggers: A mapping of loggerr fullnames -> loggers. If not

This comment was marked as spam.

This comment was marked as spam.

@tseaver
Copy link
Contributor Author

tseaver commented Mar 10, 2016

@dhermes In 4f38261, _rfc3339_to_datetime uses a regex to identify/parse the nanosecond-precision timestamps emitted by the logging API: if the regex doesn't match, it re-raises the original exception emitted by strptime. PTAL

@dhermes
Copy link
Contributor

dhermes commented Mar 10, 2016

Since when do we love using regex everywhere? My question about a guarantee about the number of digits after the decimal point is still unanswered. Do you know if it will always be 9? Do trailing 0's get chopped?

The goal of my feedback was to avoid having to catch the ValueError and that fix doesn't really capture it

@tseaver
Copy link
Contributor Author

tseaver commented Mar 10, 2016

Since when do we love using regex everywhere?

The regex gives us a way to parse the new format which is a) faster, b) easier to understand, c) less error prone than the manual parsing I initially added.

My question about a guarantee about the number of digits after the decimal point is still unanswered.

The docs promise "nanosecond precision", which requires 9 digits, even with trailing zeroes.

The goal of my feedback was to avoid having to catch the ValueError and that fix doesn't really capture it

We cannot do anything sensible with hypothetical malformed values from the backend, and the previous code didn't try to prevent them (in fact, this code comes from me exposing them when talking to the logging API). If we come across another timestamp format when mapping a new API, then we will have to adjust this helper again: I see that as a better alternative than trying to smother ValueErrors here.

@tseaver
Copy link
Contributor Author

tseaver commented Mar 10, 2016

I have what might be a better idea: rather than overloading the existing _rfc3339_to_datetime to handle the new nanosecond format, I could just add a separate helper (_rfc3339_nanos_to_datetime), which would be used only for parsing timestamps specified as being nanosecond-precision.

@tseaver
Copy link
Contributor Author

tseaver commented Mar 11, 2016

@dhermes PTAL again. I think splitting the two branches into separate functions worked out well.

I'll be glad to squash everything down before merging.

@dhermes
Copy link
Contributor

dhermes commented Mar 11, 2016

LGTM. Squashing commits would be nice if it isn't too much

@tseaver
Copy link
Contributor Author

tseaver commented Mar 11, 2016

Squashed. I will merge after Travis.

tseaver added a commit that referenced this pull request Mar 11, 2016
@tseaver tseaver merged commit 68baa1b into googleapis:logging-api Mar 11, 2016
@tseaver tseaver deleted the logging-client_list_entries branch March 11, 2016 16:55
parthea added a commit that referenced this pull request Nov 24, 2025
* ci: attempt to speed up ci

* revert
parthea pushed a commit that referenced this pull request Nov 26, 2025
* chore: initial setup for async auth sessions api (#1571)

* chore: initial setup for async auth sessions api

* fix whitespace

* add init file

* update file names to aiohttp

* update import statement

* feat: Implement asynchronous timeout context manager (#1569)

* feat: implement async timeout guard

* add docstring

* clean whitespace

* update import file name

* add missing return statement

* update test cases

* update test cases

* include underlying timeout exception in trace

* avoid the cost of actual time

* feat: Implement asynchronous `AuthorizedSession` api response class (#1575)

* feat: implement asynchronous response class for AuthorizedSessions API

* check if aiohttp is installed and avoid tests dependency

* update content to be async

* update docstring to be specific to aiohttp

* add type checking and avoid leaking underlying API responses

* add test case for iterating chunks

* add read method to response interface

* address PR comments

* fix lint issues

* feat: Implement asynchronous `AuthorizedSession` api request class (#1579)

* feat: implement request class for asynchoronous AuthorizedSession API

* add type checking and address TODOs

* remove default values from interface methods

* aiohttp reponse close method must not be awaited

* cleanup

* update Request class docstring

* feat: Implement asynchronous `AuthorizedSession` class (#1580)

* feat: Implement Asynchronous AuthorizedSession class

* add comment for implementing locks within refresh

* move timeout guard to sessions

* add unit tests and code cleanup

* implement async exponential backoff iterator

* cleanup

* add testing for http methods and cleanup

* update number of retries to 3

* refactor test cases

* fix linter and mypy issues

* fix pytest code coverage

* fix: avoid leaking api error for closed session

* add error handling for response

* cleanup default values and add test coverage

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* cleanup: minor code cleanup (#1589)

* chore: Add aiohttp requirements test constraint. (#1566)

See googleapis/google-auth-library-python#1565
for more information.

* chore(main): release 2.33.0 (#1560)

* chore(main): release 2.33.0

* fix: retry token request on retryable status code (#1563)

* fix: retry token request on retryable status code

* feat(auth): Update get_client_ssl_credentials to support X.509 workload certs (#1558)

* feat(auth): Update get_client_ssl_credentials to support X.509 workload certs

* feat(auth): Update has_default_client_cert_source

* feat(auth): Fix formatting

* feat(auth): Fix test__mtls_helper.py

* feat(auth): Fix function name in tests

* chore: Refresh system test creds.

* feat(auth): Fix style

* feat(auth): Fix casing

* feat(auth): Fix linter issue

* feat(auth): Fix coverage issue

---------

Co-authored-by: Carl Lundin <[email protected]>
Co-authored-by: Carl Lundin <[email protected]>

* chore: Update ECP deps. (#1583)

* chore(main): release 2.34.0 (#1574)

* cleanup: minor code cleanup

* fix lint issues

---------

Co-authored-by: Carl Lundin <[email protected]>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Andy Zhao <[email protected]>
Co-authored-by: Carl Lundin <[email protected]>

* update secrets from forked repo

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: arithmetic1728 <[email protected]>
Co-authored-by: Carl Lundin <[email protected]>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Andy Zhao <[email protected]>
Co-authored-by: Carl Lundin <[email protected]>
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. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants