This repository was archived by the owner on Apr 7, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
main/java/com/google/cloud/spanner
test/java/com/google/cloud/spanner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ class TraceWrapper {
5555 AttributeKey .stringKey ("gcp.client.version" );
5656 private static final AttributeKey <String > GCP_CLIENT_REPO_KEY =
5757 AttributeKey .stringKey ("gcp.client.repo" );
58+ private static final AttributeKey <String > GCP_RESOURCE_NAME_KEY =
59+ AttributeKey .stringKey ("gcp.resource.name" );
5860 private static final AttributeKey <String > THREAD_NAME_KEY = AttributeKey .stringKey ("thread.name" );
5961
6062 private final Tracer openCensusTracer ;
@@ -219,6 +221,7 @@ Attributes createDatabaseAttributes(DatabaseId db) {
219221 AttributesBuilder builder = Attributes .builder ();
220222 builder .put (DB_NAME_KEY , db .getDatabase ());
221223 builder .put (INSTANCE_NAME_KEY , db .getInstanceId ().getInstance ());
224+ builder .put (GCP_RESOURCE_NAME_KEY , "//spanner.googleapis.com/" + db .getName ());
222225 return builder .build ();
223226 }
224227
Original file line number Diff line number Diff line change @@ -912,6 +912,9 @@ private static void verifyCommonAttributes(SpanData span) {
912912 assertEquals (
913913 span .getAttributes ().get (AttributeKey .stringKey ("gcp.client.version" )),
914914 GaxProperties .getLibraryVersion (TraceWrapper .class ));
915+ assertEquals (
916+ span .getAttributes ().get (AttributeKey .stringKey ("gcp.resource.name" )),
917+ "//spanner.googleapis.com/projects/my-project/instances/my-instance/databases/my-database" );
915918 }
916919
917920 private static void verifyTableAttributes (SpanData span ) {
You can’t perform that action at this time.
0 commit comments