Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class TraceWrapper {
AttributeKey.stringKey("gcp.client.version");
private static final AttributeKey<String> GCP_CLIENT_REPO_KEY =
AttributeKey.stringKey("gcp.client.repo");
private static final AttributeKey<String> GCP_RESOURCE_NAME_KEY =
AttributeKey.stringKey("gcp.resource.name");
private static final String GCP_RESOURCE_NAME_PREFIX = "//spanner.googleapis.com/";
private static final AttributeKey<String> THREAD_NAME_KEY = AttributeKey.stringKey("thread.name");

private final Tracer openCensusTracer;
Expand Down Expand Up @@ -219,6 +222,7 @@ Attributes createDatabaseAttributes(DatabaseId db) {
AttributesBuilder builder = Attributes.builder();
builder.put(DB_NAME_KEY, db.getDatabase());
builder.put(INSTANCE_NAME_KEY, db.getInstanceId().getInstance());
builder.put(GCP_RESOURCE_NAME_KEY, GCP_RESOURCE_NAME_PREFIX + db.getName());
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,11 @@ private static void verifyCommonAttributes(SpanData span) {
assertEquals(
span.getAttributes().get(AttributeKey.stringKey("gcp.client.version")),
GaxProperties.getLibraryVersion(TraceWrapper.class));
assertEquals(
span.getAttributes().get(AttributeKey.stringKey("gcp.resource.name")),
String.format(
"//spanner.googleapis.com/projects/%s/instances/%s/databases/%s",
TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE));
}

private static void verifyTableAttributes(SpanData span) {
Expand Down
Loading