From a1f3a2a0718fd72775ca7c08ddf7168d97a6ac44 Mon Sep 17 00:00:00 2001 From: surbhigarg92 Date: Tue, 11 Feb 2025 12:28:05 +0530 Subject: [PATCH] chore: add span cloud region attribute --- .../src/main/java/com/google/cloud/spanner/TraceWrapper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java index 606a54fe8b7..df5874cb3c6 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java @@ -47,6 +47,8 @@ class TraceWrapper { private static final AttributeKey> DB_STATEMENT_ARRAY_KEY = AttributeKey.stringArrayKey("db.statement"); private static final AttributeKey DB_TABLE_NAME_KEY = AttributeKey.stringKey("db.table"); + private static final AttributeKey CLOUD_REGION_KEY = + AttributeKey.stringKey("cloud.region"); private static final AttributeKey GCP_CLIENT_SERVICE_KEY = AttributeKey.stringKey("gcp.client.service"); private static final AttributeKey GCP_CLIENT_VERSION_KEY = @@ -214,6 +216,7 @@ Attributes createCommonAttributes(DatabaseId db) { builder.put(GCP_CLIENT_SERVICE_KEY, "spanner"); builder.put(GCP_CLIENT_REPO_KEY, "googleapis/java-spanner"); builder.put(GCP_CLIENT_VERSION_KEY, GaxProperties.getLibraryVersion(TraceWrapper.class)); + builder.put(CLOUD_REGION_KEY, BuiltInMetricsProvider.detectClientLocation()); return builder.build(); }