-
Notifications
You must be signed in to change notification settings - Fork 59
Version 2.0.0 not working with opencensus-ext-google-cloud-clientlibs #107
Description
Environment
- Windows 10 WSL Debian
- Python 3.8.2
- Pip v20.2.3
google-cloud-loggingv2.0.0opencensusv0.7.11opencensus-ext-google-cloud-clientlibsv0.1.2
Steps to reproduce
I have an AppEngine app using the python38 runtime. I trace calls to NDB using opencensus and the opencensus-ext-google-cloud-clientlibs extension. After upgrading to google-cloud-logging v2.0.0, instead of log messages in the app's log, exception tracebacks are logged. The following simplied code running locally (with the GOOGLE_APPLICATION_CREDENTIALS environment variable set) produces the same exception as in the app log:
import logging
from google.cloud import logging as gcp_logging
from opencensus.trace import config_integration
config_integration.trace_integrations(['google_cloud_clientlibs'])
gcp_logging_client = gcp_logging.Client()
gcp_logging_client.setup_logging(log_level=logging.INFO)
logging.info("Testing 123!!")
Using google-cloud-logging v1.15.1, the code above produces the following local terminal output and successfully logs to my project in the cloud.
Testing 123!!
Waiting up to 5 seconds.
Sent all pending logs.
Using google-cloud-logging v2.0.0 no log is sent to the cloud due to a KeyError: 'ByteSize' exception. The output is:,
Testing 123!!
Waiting up to 5 seconds.
Failed to submit 1 logs.
Traceback (most recent call last):
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/proto/message.py", line 555, in __getattr__
pb_type = self._meta.fields[key].pb_type
KeyError: 'ByteSize'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/google/cloud/logging_v2/handlers/transports/background_thread.py", line 115, in _safely_commit_batch
batch.commit()
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/google/cloud/logging_v2/logger.py", line 381, in commit
client.logging_api.write_entries(entries, **kwargs)
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/google/cloud/logging_v2/_gapic.py", line 149, in write_entries
self._gapic_api.write_log_entries(request=request)
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/google/cloud/logging_v2/services/logging_service_v2/client.py", line 566, in write_log_entries
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
return wrapped_func(*args, **kwargs)
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/google/api_core/retry.py", line 281, in retry_wrapped_func
return retry_target(
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/google/api_core/retry.py", line 184, in retry_target
return target()
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
return callable_(*args, **kwargs)
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/grpc/_interceptor.py", line 216, in __call__
response, ignored_call = self._with_call(request,
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/grpc/_interceptor.py", line 254, in _with_call
call = self._interceptor.intercept_unary_unary(continuation,
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/opencensus/ext/grpc/client_interceptor.py", line 166, in intercept_unary_unary
next(new_request))
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/opencensus/ext/grpc/utils.py", line 29, in wrap_iter_with_message_events
add_message_event(
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/opencensus/ext/grpc/utils.py", line 18, in add_message_event
uncompressed_size_bytes=proto_message.ByteSize()
File "/home/john/python_envs/tov_flask/lib/python3.8/site-packages/proto/message.py", line 560, in __getattr__
raise AttributeError(str(ex))
AttributeError: 'ByteSize'
Sent all pending logs.
If I remove config_integration.trace_integrations(['google_cloud_clientlibs']) from the script above, everything works as expected using v2.0.0.