question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatibility With Recent GCP SDK Versions

See original GitHub issue

Describe your environment.

The code is an asynchronous workload running in GKE.

Python 3.7.9

google-api-core==1.22.3 google-auth==1.22.0 google-cloud-bigquery==1.20.0 google-cloud-core==1.3.0 google-cloud-error-reporting==0.32.1 google-cloud-kms==2.2.0 opencensus-context==0.1.1 opencensus-ext-google-cloud-clientlibs==0.1.2 opencensus-ext-grpc==0.7.1

Steps to reproduce.

  1. Enable the google_cloud_clientlibs integration
  2. Call the GCP KMS API using the Python SDK client.

What is the expected behavior?

The GRPC call to the KMS API is traced automatically.

What is the actual behavior?

The following (partially redacted) exception is raised because it seems that the opencensus.ext.grpc.utils. add_message_event function assumes that all Message objects will have ByteSize method. Recently the official GCP SDK packages for Python have begun to use the proto plus package, and that version of the Message object does not have the ByteSize method.

Additional context.

Traceback (most recent call last):
  File "/redacted.py", line 167, in redacted
    public_key = client.get_public_key(request={"name": key_name})
  File "/usr/local/lib/python3.7/site-packages/google/cloud/kms_v1/services/key_management_service/client.py", line 1026, in get_public_key
    response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
  File "/usr/local/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
    return wrapped_func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 286, in retry_wrapped_func
    on_error=on_error,
  File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 184, in retry_target
    return target()
  File "/usr/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/grpc/_interceptor.py", line 221, in __call__
    compression=compression)
  File "/usr/local/lib/python3.7/site-packages/grpc/_interceptor.py", line 256, in _with_call
    request)
  File "/usr/local/lib/python3.7/site-packages/opencensus/ext/grpc/client_interceptor.py", line 166, in intercept_unary_unary
    next(new_request))
  File "/usr/local/lib/python3.7/site-packages/opencensus/ext/grpc/utils.py", line 33, in wrap_iter_with_message_events
    message_id=message_id)
  File "/usr/local/lib/python3.7/site-packages/opencensus/ext/grpc/utils.py", line 18, in add_message_event
    uncompressed_size_bytes=proto_message.ByteSize()
  File "/usr/local/lib/python3.7/site-packages/proto/message.py", line 525, in __getattr__
    raise AttributeError(str(ex))
AttributeError: 'ByteSize'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
seandstewartcommented, Nov 1, 2020

proto-plus provides access to the underlying protobuf with the pb() classmethod.

https://proto-plus-python.readthedocs.io/en/stable/reference/message.html#proto.message.Message.pb

0reactions
aabmasscommented, Nov 19, 2020

No workaround, but the fix should be straightforward

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compatibility | Cloud APIs
Wherever possible, test changes you're considering by generating new versions of client libraries and making sure their tests still pass.
Read more >
How to update a Dataflow incompatible pipeline without ...
You need to make an update to the code that will make the new Cloud Dataflow pipeline incompatible with the current version.
Read more >
Maps SDK for iOS versions - Google Developers
The Google Maps Platform team regularly updates SDKs with new features, bug fixes, and performance improvements. This page provides guidance on how to ......
Read more >
Compatibility and requirements for Infrastructure Integrations ...
To use SDK v3, you must have agent version 1.0.888 or higher. For Infrastructure agent version information and options for installation and updates,...
Read more >
SDK Compatibility With Capella | Couchbase Docs
The following minimum versions of Couchbase SDKs are supported by Capella (everything ... We strongly advise using the latest version of your preferred...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found