diff --git a/physical/spanner/spanner.go b/physical/spanner/spanner.go index a8d6628697..c01557d2ca 100644 --- a/physical/spanner/spanner.go +++ b/physical/spanner/spanner.go @@ -64,6 +64,9 @@ var ( // metricPut is the key for the metric for measuring a Put call. metricPut = []string{"spanner", "put"} + + // metricTxn is the key for the metric for measuring a Transaction call. + metricTxn = []string{"spanner", "txn"} ) // Backend implements physical.Backend and describes the steps necessary to @@ -193,7 +196,7 @@ func (b *Backend) Put(ctx context.Context, entry *physical.Entry) error { // Get fetches an entry. If there is no entry, this function returns nil. func (b *Backend) Get(ctx context.Context, key string) (*physical.Entry, error) { - defer metrics.MeasureSince(metricList, time.Now()) + defer metrics.MeasureSince(metricGet, time.Now()) // Pooling b.permitPool.Acquire() @@ -293,6 +296,8 @@ func (b *Backend) List(ctx context.Context, prefix string) ([]string, error) { // Transaction runs multiple entries via a single transaction. func (b *Backend) Transaction(ctx context.Context, txns []*physical.TxnEntry) error { + defer metrics.MeasureSince(metricTxn, time.Now()) + // Quit early if we can if len(txns) == 0 { return nil