Skip to content

Commit c8d1e63

Browse files
authored
chore: add span cloud region attribute (#3633)
1 parent 2373e34 commit c8d1e63

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ 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+
private static final AttributeKey<String> CLOUD_REGION_KEY =
51+
AttributeKey.stringKey("cloud.region");
5052
private static final AttributeKey<String> GCP_CLIENT_SERVICE_KEY =
5153
AttributeKey.stringKey("gcp.client.service");
5254
private static final AttributeKey<String> GCP_CLIENT_VERSION_KEY =
@@ -214,6 +216,7 @@ Attributes createCommonAttributes(DatabaseId db) {
214216
builder.put(GCP_CLIENT_SERVICE_KEY, "spanner");
215217
builder.put(GCP_CLIENT_REPO_KEY, "googleapis/java-spanner");
216218
builder.put(GCP_CLIENT_VERSION_KEY, GaxProperties.getLibraryVersion(TraceWrapper.class));
219+
builder.put(CLOUD_REGION_KEY, BuiltInMetricsProvider.detectClientLocation());
217220
return builder.build();
218221
}
219222

0 commit comments

Comments
 (0)