This repository was archived by the owner on Mar 4, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,7 +126,10 @@ describe('startTrace', () => {
126126 } ) ;
127127
128128 it ( 'with semantic attributes' , ( ) => {
129- const opts = { tableName : 'table' , dbName : 'db' } ;
129+ const opts = {
130+ tableName : 'table' ,
131+ dbName : 'projects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID' ,
132+ } ;
130133 startTrace ( 'aSpan' , opts , span => {
131134 assert . equal (
132135 span . attributes [ ATTR_OTEL_SCOPE_NAME ] ,
@@ -158,6 +161,12 @@ describe('startTrace', () => {
158161 'Missing gcp.client.repo attribute' ,
159162 ) ;
160163
164+ assert . equal (
165+ span . attributes [ 'gcp.resource.name' ] ,
166+ '//spanner.googleapis.com/projects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID' ,
167+ 'Missing gcp.resource.name attribute' ,
168+ ) ;
169+
161170 assert . equal (
162171 span . attributes [ SEMATTRS_DB_SQL_TABLE ] ,
163172 'table' ,
Original file line number Diff line number Diff line change @@ -150,6 +150,10 @@ export function startTrace<T>(
150150 span . setAttribute ( 'db.sql.table' , config . tableName ) ;
151151 }
152152 if ( config . dbName ) {
153+ span . setAttribute (
154+ 'gcp.resource.name' ,
155+ `//spanner.googleapis.com/${ config . dbName } ` ,
156+ ) ;
153157 span . setAttribute ( 'db.name' , config . dbName ) ;
154158 }
155159 if ( config . requestTag ) {
You can’t perform that action at this time.
0 commit comments