Skip to content

Commit

Permalink
fix(spanner): handle errors (#10943)
Browse files Browse the repository at this point in the history
Co-authored-by: rahul2393 <irahul@google.com>
  • Loading branch information
egonelbre and rahul2393 authored Oct 3, 2024
1 parent 0b4c4e7 commit c67f964
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spanner/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ func (tf *builtinMetricsTracerFactory) createInstruments(meter metric.Meter) err
metric.WithDescription("The count of database operations."),
metric.WithUnit(metricUnitCount),
)
if err != nil {
return err
}

// Create attempt_count
tf.attemptCount, err = meter.Int64Counter(
Expand Down
3 changes: 3 additions & 0 deletions spanner/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,9 @@ func TestReadWriteStmtBasedTransactionWithOptions(t *testing.T) {
break
} else if err == nil {
resp, err = tx.CommitWithReturnResp(ctx)
if err != nil {
t.Fatalf("failed to CommitWithReturnResp: %v", err)
}
break
}
// Set a default sleep time if the server delay is absent.
Expand Down

0 comments on commit c67f964

Please sign in to comment.