Skip to content

Commit e2a4d6d

Browse files
committed
chore: add threading import
1 parent 29bf7a1 commit e2a4d6d

File tree

1 file changed

+11
-0
lines changed
  • packages/google-cloud-spanner/google/cloud/spanner_v1

1 file changed

+11
-0
lines changed

packages/google-cloud-spanner/google/cloud/spanner_v1/snapshot.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
"""Model a set of read-only queries to a database as a snapshot."""
1919
import functools
20+
import threading
2021
from typing import List, Optional, Union
2122
from google.api_core import gapic_v1
2223
from google.api_core.exceptions import (
@@ -209,6 +210,16 @@ def __init__(self, session, client_context=None):
209210
# This is used to prevent the "Transaction has not begun" race condition.
210211
self._transaction_begin_event = threading.Event()
211212

213+
@property
214+
def _resource_info(self):
215+
"""Resource information for metrics labels."""
216+
database = self._session._database
217+
return {
218+
"project": database._instance._client.project,
219+
"instance": database._instance.instance_id,
220+
"database": database.database_id,
221+
}
222+
212223
def begin(self) -> bytes:
213224
"""Begins a transaction on the database.
214225

0 commit comments

Comments
 (0)