|
16 | 16 |
|
17 | 17 | package com.google.cloud.spanner; |
18 | 18 |
|
| 19 | +import com.google.api.gax.core.GaxProperties; |
19 | 20 | import com.google.cloud.spanner.Options.TagOption; |
20 | 21 | import com.google.cloud.spanner.Options.TransactionOption; |
21 | 22 | import com.google.cloud.spanner.SpannerOptions.TracingFramework; |
| 23 | +import com.google.cloud.spanner.spi.v1.GapicSpannerRpc; |
22 | 24 | import com.google.common.base.MoreObjects; |
23 | 25 | import io.opencensus.trace.BlankSpan; |
24 | 26 | import io.opencensus.trace.Span; |
@@ -46,6 +48,9 @@ class TraceWrapper { |
46 | 48 | private static final AttributeKey<List<String>> DB_STATEMENT_ARRAY_KEY = |
47 | 49 | AttributeKey.stringArrayKey("db.statement"); |
48 | 50 | private static final AttributeKey<String> DB_TABLE_NAME_KEY = AttributeKey.stringKey("db.table"); |
| 51 | + private static final AttributeKey<String> GCP_CLIENT_SERVICE_KEY = AttributeKey.stringKey("gcp.client.service"); |
| 52 | + private static final AttributeKey<String> GCP_CLIENT_VERSION_KEY = AttributeKey.stringKey("gcp.client.version"); |
| 53 | + private static final AttributeKey<String> GCP_CLIENT_REPO_KEY = AttributeKey.stringKey("gcp.client.repo"); |
49 | 54 | private static final AttributeKey<String> THREAD_NAME_KEY = AttributeKey.stringKey("thread.name"); |
50 | 55 |
|
51 | 56 | private final Tracer openCensusTracer; |
@@ -204,6 +209,9 @@ Attributes createCommonAttributes(DatabaseId db) { |
204 | 209 | AttributesBuilder builder = Attributes.builder(); |
205 | 210 | builder.put(DB_NAME_KEY, db.getDatabase()); |
206 | 211 | builder.put(INSTANCE_NAME_KEY, db.getInstanceId().getInstance()); |
| 212 | + builder.put(GCP_CLIENT_SERVICE_KEY, "Spanner"); |
| 213 | + builder.put(GCP_CLIENT_REPO_KEY, "googleapis/java-spanner"); |
| 214 | + builder.put(GCP_CLIENT_VERSION_KEY, GaxProperties.getLibraryVersion(TraceWrapper.class)); |
207 | 215 | return builder.build(); |
208 | 216 | } |
209 | 217 |
|
|
0 commit comments