Skip to content

GAX can't log nested structs #2552

Description

@waprin

This is the root issue in #2521 , if we feel it's the same issue can just rename that one. But when using gax,

fromgoogle.cloudimportloggingclient=logging.Client()
logger=client.logger('errors')
payload= {
'a': {
'b': 'c',
}
}
logger.log_struct(payload)

produces:

File"e.py", line22, in<module>logger.log_struct(payload)
File"/Users/waprin/.virtualenvs/tasks/lib/python2.7/site-packages/google/cloud/logging/logger.py", line226, inlog_structclient.logging_api.write_entries([entry_resource])
File"/Users/waprin/.virtualenvs/tasks/lib/python2.7/site-packages/google/cloud/logging/_gax.py", line108, inwrite_entriesentry_pbs= [_log_entry_mapping_to_pb(entry) forentryinentries]
File"/Users/waprin/.virtualenvs/tasks/lib/python2.7/site-packages/google/cloud/logging/_gax.py", line607, in_log_entry_mapping_to_pbentry_pb.json_payload[key] =valueFile"/Users/waprin/.virtualenvs/tasks/lib/python2.7/site-packages/google/protobuf/internal/well_known_types.py", line732, in__setitem___SetStructValue(self.fields[key], value)
File"/Users/waprin/.virtualenvs/tasks/lib/python2.7/site-packages/google/protobuf/internal/well_known_types.py", line702, in_SetStructValueraiseValueError('Unexpected type')
ValueError: Unexpectedtype

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the Cloud Logging API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions