tracing: trace_call returns None if opentelemetry is not enabled or if no session but that makes it awkward to seamlessly use library, it should return a NoopSpan
odeke-em opened this issue · 0 comments
odeke-em commented
If we examine the code for trace_call it returns None
python-spanner/google/cloud/spanner_v1/_opentelemetry_tracing.py
Lines 32 to 36 in a941adb
and when we try to perform what should be a simple thing like add annotations, we have to awkwardly check if span is not None
and that's not a good user experience.
Remedy
- Let's implement a NoopSpan which has all the methods for a Span but does nothing