FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allowing for arbitrarily nested dictionaries in _log_entry_mapping_pb. by dhermes · Pull Request #2589 · googleapis/google-cloud-python · GitHub

Allowing for arbitrarily nested dictionaries in _log_entry_mapping_pb. - #2589

Merged
dhermes merged 2 commits into
googleapis:masterfrom
dhermes:fix-2552
Oct 24, 2016
Merged

Allowing for arbitrarily nested dictionaries in _log_entry_mapping_pb.#2589
dhermes merged 2 commits into
googleapis:masterfrom
dhermes:fix-2552

Conversation

dhermes commented Oct 22, 2016

Copy link
Copy Markdown
Contributor

Fixes #2552.

@waprin Do you think it's worthwhile to add a system test for this / update an existing system test with a nested dictionary?

dhermes added the api: logging Issues related to the Cloud Logging API. label Oct 22, 2016
googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 22, 2016
Comment thread logging/google/cloud/logging/_gax.py Outdated
# NOTE: ``json.dumps`` is wasteful here because internally,
# ``Parse`` will just call ``json.loads``. However,
# there is no equivalent public function to parse on raw
# dictionaries, so we waste cycles on parse/unparse.

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.

Copy link
Copy Markdown
Contributor

@dhermes, did you try this on the service and confirm that the data gets logged correctly?
I haven't found an issue but I'm curious if the upstream service captures the nested data properly.

dhermes commented Oct 24, 2016

Copy link
Copy Markdown
Contributor Author

@daspecster

>>> from google.cloud import logging
>>> client = logging.Client()
>>> logger = client.logger('errors')
>>> 
>>> payload = {
...     'a': {
...         'b': 'c',
...     }
... }
>>> logger.log_struct(payload)
>>> 

waprin commented Oct 24, 2016

Copy link
Copy Markdown
Contributor

@dhermes thanks for figuring this out for me, works for me. As for system test, I think it'd be trivial to add it just by adding one level of nesting to the current log_struct system test.

dhermes commented Oct 24, 2016

Copy link
Copy Markdown
Contributor Author

@waprin Good find on ParseDict, updated it in the 2nd commit (and also updated the system test).

waprin commented Oct 24, 2016

Copy link
Copy Markdown
Contributor

LGTM!

dhermes merged commit 05b5059 into googleapis:master Oct 24, 2016
dhermes deleted the fix-2552 branch October 24, 2016 18:19
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
Allowing for arbitrarily nested dictionaries in _log_entry_mapping_pb.
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

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.

5 participants


Back | FazBrowse Home | New Git URL