Skip to content

Commit 8d7c32e

Browse files
committed
chore: Add gcp resource name span attribute
1 parent 61c33e3 commit 8d7c32e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class TraceWrapper {
5757
AttributeKey.stringKey("gcp.client.repo");
5858
private static final AttributeKey<String> GCP_RESOURCE_NAME_KEY =
5959
AttributeKey.stringKey("gcp.resource.name");
60+
private static final String GCP_RESOURCE_NAME_PREFIX = "//spanner.googleapis.com/";
6061
private static final AttributeKey<String> THREAD_NAME_KEY = AttributeKey.stringKey("thread.name");
6162

6263
private final Tracer openCensusTracer;
@@ -221,7 +222,7 @@ Attributes createDatabaseAttributes(DatabaseId db) {
221222
AttributesBuilder builder = Attributes.builder();
222223
builder.put(DB_NAME_KEY, db.getDatabase());
223224
builder.put(INSTANCE_NAME_KEY, db.getInstanceId().getInstance());
224-
builder.put(GCP_RESOURCE_NAME_KEY, "//spanner.googleapis.com/" + db.getName());
225+
builder.put(GCP_RESOURCE_NAME_KEY, GCP_RESOURCE_NAME_PREFIX + db.getName());
225226
return builder.build();
226227
}
227228

0 commit comments

Comments
 (0)