From 391f77eb0821adebd805d78c1e1e6cc5189977c4 Mon Sep 17 00:00:00 2001 From: Nick Dimiduk Date: Mon, 10 Jan 2022 17:02:50 -0800 Subject: [PATCH] HBASE-26520 Remove use of `db.hbase.namespance` tracing attribute (#4015) The HBase-specific attribute `db.hbase.namespace` has been deprecated in favor of the generic `db.name`. See also https://github.com/open-telemetry/opentelemetry-specification/issues/1760 Signed-off-by: Duo Zhang Signed-off-by: Tak Lon (Stephen) Wu --- .../org/apache/hadoop/hbase/client/trace/TableSpanBuilder.java | 2 -- .../java/org/apache/hadoop/hbase/client/TestTracingBase.java | 2 +- .../hadoop/hbase/client/trace/hamcrest/TraceTestUtil.java | 1 - .../org/apache/hadoop/hbase/trace/HBaseSemanticAttributes.java | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/trace/TableSpanBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/trace/TableSpanBuilder.java index 8973da66be76..437c70b409f7 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/trace/TableSpanBuilder.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/trace/TableSpanBuilder.java @@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.client.trace; import static org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.DB_NAME; -import static org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.NAMESPACE_KEY; import static org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.TABLE_KEY; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.Span; @@ -92,7 +91,6 @@ static void populateTableNameAttributes( final Map, Object> attributes, final TableName tableName ) { - attributes.put(NAMESPACE_KEY, tableName.getNamespaceAsString()); attributes.put(DB_NAME, tableName.getNamespaceAsString()); attributes.put(TABLE_KEY, tableName.getNameAsString()); } diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTracingBase.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTracingBase.java index c2067e75c671..34633481c210 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTracingBase.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTracingBase.java @@ -89,7 +89,7 @@ protected void assertTrace(String className, String methodName, ServerName serve if (tableName != null) { assertEquals(tableName.getNamespaceAsString(), - data.getAttributes().get(HBaseSemanticAttributes.NAMESPACE_KEY)); + data.getAttributes().get(HBaseSemanticAttributes.DB_NAME)); assertEquals(tableName.getNameAsString(), data.getAttributes().get(HBaseSemanticAttributes.TABLE_KEY)); } diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/trace/hamcrest/TraceTestUtil.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/trace/hamcrest/TraceTestUtil.java index 21d37e84c664..71aedbde6497 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/trace/hamcrest/TraceTestUtil.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/trace/hamcrest/TraceTestUtil.java @@ -59,7 +59,6 @@ public static Matcher buildConnectionAttributesMatcher(ConnectionImple public static Matcher buildTableAttributesMatcher(TableName tableName) { return hasAttributes(allOf( containsEntry("db.name", tableName.getNamespaceAsString()), - containsEntry("db.hbase.namespace", tableName.getNamespaceAsString()), containsEntry("db.hbase.table", tableName.getNameAsString()))); } } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseSemanticAttributes.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseSemanticAttributes.java index 59c372f8a782..fd6ab852e063 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseSemanticAttributes.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseSemanticAttributes.java @@ -34,7 +34,6 @@ public final class HBaseSemanticAttributes { SemanticAttributes.DB_CONNECTION_STRING; public static final AttributeKey DB_USER = SemanticAttributes.DB_USER; public static final AttributeKey DB_NAME = SemanticAttributes.DB_NAME; - public static final AttributeKey NAMESPACE_KEY = SemanticAttributes.DB_HBASE_NAMESPACE; public static final AttributeKey DB_OPERATION = SemanticAttributes.DB_OPERATION; public static final AttributeKey TABLE_KEY = AttributeKey.stringKey("db.hbase.table"); public static final AttributeKey> REGION_NAMES_KEY =