Skip to content

Commit a69a4dc

Browse files
committed
Remove span event per mutation in favour of future TODO
Referencing issue #1269, this update removes adding a span event per mutation, in favour of a future TODO.
1 parent a6e602f commit a69a4dc

File tree

2 files changed

+11
-38
lines changed

2 files changed

+11
-38
lines changed

google/cloud/spanner_v1/_opentelemetry_tracing.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def trace_call(name, session=None, extra_attributes=None, observability_options=
103103

104104
if not enable_extended_tracing:
105105
attributes.pop("db.statement", False)
106-
attributes.pop("sql", False)
107106

108107
with tracer.start_as_current_span(
109108
name, kind=trace.SpanKind.CLIENT, attributes=attributes
@@ -136,16 +135,3 @@ def get_current_span():
136135
def add_span_event(span, event_name, event_attributes=None):
137136
if span:
138137
span.add_event(event_name, event_attributes)
139-
140-
141-
def add_event_on_current_span(event_name, event_attributes=None, span=None):
142-
if not span:
143-
span = get_current_span()
144-
145-
add_span_event(span, event_name, event_attributes)
146-
147-
148-
def record_span_exception_and_status(span, exc):
149-
if span:
150-
span.set_status(Status(StatusCode.ERROR, str(exc)))
151-
span.record_exception(exc)

google/cloud/spanner_v1/batch.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
_metadata_with_prefix,
2727
_metadata_with_leader_aware_routing,
2828
)
29-
from google.cloud.spanner_v1._opentelemetry_tracing import (
30-
add_event_on_current_span,
31-
trace_call,
32-
)
29+
from google.cloud.spanner_v1._opentelemetry_tracing import trace_call
3330
from google.cloud.spanner_v1 import RequestOptions
3431
from google.cloud.spanner_v1._helpers import _retry
3532
from google.cloud.spanner_v1._helpers import _check_rst_stream_error
@@ -73,10 +70,8 @@ def insert(self, table, columns, values):
7370
:param values: Values to be modified.
7471
"""
7572
self._mutations.append(Mutation(insert=_make_write_pb(table, columns, values)))
76-
add_event_on_current_span(
77-
"insert mutations added",
78-
dict(table=table, columns=columns),
79-
)
73+
# TODO: Decide if we should add a span event per mutation:
74+
# https://github.com/googleapis/python-spanner/issues/1269
8075

8176
def update(self, table, columns, values):
8277
"""Update one or more existing table rows.
@@ -91,10 +86,8 @@ def update(self, table, columns, values):
9186
:param values: Values to be modified.
9287
"""
9388
self._mutations.append(Mutation(update=_make_write_pb(table, columns, values)))
94-
add_event_on_current_span(
95-
"update mutations added",
96-
dict(table=table, columns=columns),
97-
)
89+
# TODO: Decide if we should add a span event per mutation:
90+
# https://github.com/googleapis/python-spanner/issues/1269
9891

9992
def insert_or_update(self, table, columns, values):
10093
"""Insert/update one or more table rows.
@@ -111,10 +104,8 @@ def insert_or_update(self, table, columns, values):
111104
self._mutations.append(
112105
Mutation(insert_or_update=_make_write_pb(table, columns, values))
113106
)
114-
add_event_on_current_span(
115-
"insert_or_update mutations added",
116-
dict(table=table, columns=columns),
117-
)
107+
# TODO: Decide if we should add a span event per mutation:
108+
# https://github.com/googleapis/python-spanner/issues/1269
118109

119110
def replace(self, table, columns, values):
120111
"""Replace one or more table rows.
@@ -129,10 +120,8 @@ def replace(self, table, columns, values):
129120
:param values: Values to be modified.
130121
"""
131122
self._mutations.append(Mutation(replace=_make_write_pb(table, columns, values)))
132-
add_event_on_current_span(
133-
"replace mutations added",
134-
dict(table=table, columns=columns),
135-
)
123+
# TODO: Decide if we should add a span event per mutation:
124+
# https://github.com/googleapis/python-spanner/issues/1269
136125

137126
def delete(self, table, keyset):
138127
"""Delete one or more table rows.
@@ -145,10 +134,8 @@ def delete(self, table, keyset):
145134
"""
146135
delete = Mutation.Delete(table=table, key_set=keyset._to_pb())
147136
self._mutations.append(Mutation(delete=delete))
148-
add_event_on_current_span(
149-
"delete mutations added",
150-
dict(table=table),
151-
)
137+
# TODO: Decide if we should add a span event per mutation:
138+
# https://github.com/googleapis/python-spanner/issues/1269
152139

153140

154141
class Batch(_BatchBase):

0 commit comments

Comments
 (0)