Skip to content

Commit 2292f25

Browse files
committed
chore: add span cloud region attribute
1 parent a5ebcd3 commit 2292f25

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class TraceWrapper {
4747
private static final AttributeKey<List<String>> DB_STATEMENT_ARRAY_KEY =
4848
AttributeKey.stringArrayKey("db.statement");
4949
private static final AttributeKey<String> DB_TABLE_NAME_KEY = AttributeKey.stringKey("db.table");
50+
51+
private static final AttributeKey<String> CLOUD_REGION_KEY =
52+
AttributeKey.stringKey("cloud.region");
5053
private static final AttributeKey<String> GCP_CLIENT_SERVICE_KEY =
5154
AttributeKey.stringKey("gcp.client.service");
5255
private static final AttributeKey<String> GCP_CLIENT_VERSION_KEY =
@@ -214,6 +217,7 @@ Attributes createCommonAttributes(DatabaseId db) {
214217
builder.put(GCP_CLIENT_SERVICE_KEY, "spanner");
215218
builder.put(GCP_CLIENT_REPO_KEY, "googleapis/java-spanner");
216219
builder.put(GCP_CLIENT_VERSION_KEY, GaxProperties.getLibraryVersion(TraceWrapper.class));
220+
builder.put(CLOUD_REGION_KEY, BuiltInMetricsProvider.detectClientLocation());
217221
return builder.build();
218222
}
219223

0 commit comments

Comments
 (0)