-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(observability): more descriptive and value adding spans #1241
base: main
Are you sure you want to change the base?
feat(observability): more descriptive and value adding spans #1241
Conversation
bc1befe
to
502d0e5
Compare
Kindly help me take a look @harshachinta and help me run the bots afresh! |
google/cloud/spanner_v1/database.py
Outdated
if span: | ||
span.add_event("Starting BeginTransaction") | ||
txn = api.begin_transaction( | ||
session=session.name, options=txn_options, metadata=metadata | ||
) | ||
if span: | ||
span.add_event( | ||
"Completed BeginTransaction", {"transaction.id": txn.id} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harshachinta please take a look.
@harshachinta kindly help me run the bots one more time, I sent up a fix! |
8d613ee
to
f767159
Compare
google/cloud/spanner_v1/database.py
Outdated
if isinstance(observability_options, dict): | ||
observability_options["db_name"] = self.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do a much simpler thing instead of adding db_name manually at every place.
We have configured a @Property for observability_options in database.py
def observability_options(self): |
Can we add a new field, db_name, to observability_options if it already exists? If the customer does not provide any observability_options, we can create a new dictionary with this field. With this we need not do it at multiple places, WDYT?
google/cloud/spanner_v1/database.py
Outdated
if isinstance(observability_options, dict): | ||
observability_options["db_name"] = self.name | ||
with trace_call( | ||
"CloudSpanner.execute_partitioned_pdml", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem i see here is with every retry there will be a new span parent CloudSpanner.execute_partitioned_pdml
which does not indicate that a retry is happening.
Instead we should capture the retries with in only one parent span CloudSpanner.execute_partitioned_pdml
.
beb8bb9
to
d297b66
Compare
be40273
to
47ffdfc
Compare
cd4a8b1
to
4829a9a
Compare
8d6dad0
to
eecca2e
Compare
204067a
to
847d89b
Compare
This change carves out parts of PR googleapis#1241 in smaller pieces to ease with smaller reviews. This change adds more span events, updates important spans to make them more distinct like changing: "CloudSpanner.ReadWriteTransaction" to more direct and more pointed spans like: * CloudSpanner.Transaction.execute_streaming_sql Also added important spans: * CloudSpanner.Database.run_in_transaction * CloudSpanner.Session.run_in_transaction
This change carves out parts of PR googleapis#1241 in smaller pieces to ease with smaller reviews. This change adds more span events, updates important spans to make them more distinct like changing: "CloudSpanner.ReadWriteTransaction" to more direct and more pointed spans like: * CloudSpanner.Transaction.execute_streaming_sql Also added important spans: * CloudSpanner.Database.run_in_transaction * CloudSpanner.Session.run_in_transaction
This change carves out parts of PR googleapis#1241 in smaller pieces to ease with smaller reviews. This change adds more span events, updates important spans to make them more distinct like changing: "CloudSpanner.ReadWriteTransaction" to more direct and more pointed spans like: * CloudSpanner.Transaction.execute_streaming_sql Also added important spans: * CloudSpanner.Database.run_in_transaction * CloudSpanner.Session.run_in_transaction
This change carves out parts of PR googleapis#1241 in smaller pieces to ease with smaller reviews. This change adds more span events, updates important spans to make them more distinct like changing: "CloudSpanner.ReadWriteTransaction" to more direct and more pointed spans like: * CloudSpanner.Transaction.execute_streaming_sql Also added important spans: * CloudSpanner.Database.run_in_transaction * CloudSpanner.Session.run_in_transaction
This change carves out parts of PR googleapis#1241 in smaller pieces to ease with smaller reviews. This change adds more span events, updates important spans to make them more distinct like changing: "CloudSpanner.ReadWriteTransaction" to more direct and more pointed spans like: * CloudSpanner.Transaction.execute_streaming_sql Also added important spans: * CloudSpanner.Database.run_in_transaction * CloudSpanner.Session.run_in_transaction
This change carves out parts of PR googleapis#1241 in smaller pieces to ease with smaller reviews. This change adds more span events, updates important spans to make them more distinct like changing: "CloudSpanner.ReadWriteTransaction" to more direct and more pointed spans like: * CloudSpanner.Transaction.execute_streaming_sql Also added important spans: * CloudSpanner.Database.run_in_transaction * CloudSpanner.Session.run_in_transaction
* observability: add updated span events + traace more methods This change carves out parts of PR #1241 in smaller pieces to ease with smaller reviews. This change adds more span events, updates important spans to make them more distinct like changing: "CloudSpanner.ReadWriteTransaction" to more direct and more pointed spans like: * CloudSpanner.Transaction.execute_streaming_sql Also added important spans: * CloudSpanner.Database.run_in_transaction * CloudSpanner.Session.run_in_transaction * all: update review comments + show type for BeginTransaction + remove prints * Remove requested span event "Using Transaction" * Move attempts into try block * Transform Session.run_in_transaction retry exceptions into events * More comprehensive test for events and attributes for pool.get * Add test guards against Python3.7 for which OpenTelemetry is unavailable + address test feedback * 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. * Sort system-test.test_transaction_abort_then_retry_spans spans by create time * Delint tests
This change adds more descriptive and value adding spans to replace the generic CloudSpanner.ReadWriteTransaction. With this change, we add new spans: * CloudSpanner.Database.run_in_transaction * CloudSpanner.execute_pdml * CloudSpanner.execute_sql * CloudSpanner.execute_update
847d89b
to
f28ed47
Compare
This change adds spans for Partitioned DML and making updates for Batch. Carved out from PR googleapis#1241.
This change adds spans for Partitioned DML and making updates for Batch. Carved out from PR googleapis#1241.
This change adds more descriptive and value adding spans to replace the generic CloudSpanner.ReadWriteTransaction. With this change, we add new spans:
Exhibit
Given this code
we now have this exhibit
Without gRPC instrumentation
With gRPC instrumentation