-
Notifications
You must be signed in to change notification settings - Fork 231
Closed
Labels
Milestone
Description
Describe the bug: ...
To Reproduce
- Setup ElasticAPM in Django
- Integrate with Google PubSub client
- Try to publish message from your script
- Stacktrace:
Exception in thread Thread-CommitBatchPublisher:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/site-packages/google/cloud/pubsub_v1/publisher/_batch/thread.py", line 274, in _commit
response = self._client._gapic_publish(
File "/usr/local/lib/python3.8/site-packages/google/cloud/pubsub_v1/publisher/client.py", line 272, in _gapic_publish
return super().publish(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/google/pubsub_v1/services/publisher/client.py", line 781, in publish
response = rpc(
File "/usr/local/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py", line 113, in __call__
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/google/api_core/retry.py", line 349, in retry_wrapped_func
return retry_target(
File "/usr/local/lib/python3.8/site-packages/google/api_core/retry.py", line 191, in retry_target
return target()
File "/usr/local/lib/python3.8/site-packages/google/api_core/timeout.py", line 120, in func_with_timeout
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 72, in error_remapped_callable
return callable_(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/grpc/_interceptor.py", line 247, in __call__
response, ignored_call = self._with_call(request,
File "/usr/local/lib/python3.8/site-packages/grpc/_interceptor.py", line 287, in _with_call
call = self._interceptor.intercept_unary_unary(continuation,
File "/usr/local/lib/python3.8/site-packages/elasticapm/contrib/grpc/client_interceptor.py", line 97, in intercept_unary_unary
client_call_details = self.attach_traceparent(client_call_details, span)
File "/usr/local/lib/python3.8/site-packages/elasticapm/contrib/grpc/client_interceptor.py", line 195, in attach_traceparent
if not span.transaction:
AttributeError: 'NoneType' object has no attribute 'transaction'
Environment (please complete the following information)
- OS: Linux
- Python version: 3.8
- Framework and version [e.g. Django 2.1]: Django 3.8
- APM Server version: 7.15
- Agent version: 6.14.0
Additional context
Add any other context about the problem here.
-
requirements.txt
:Click to expand
google-cloud-pubsub==2.13.11
Initial digging
Looks like the span is not being returned from the context manager, but the grpc code is not handling the None
case.
I can make a patch to handle the None
case (and just return the client call details), but not sure if that is the right call here. Any guidance would be appreciated!