Don't extract deprecated cassandra keyspace attribute
DELETE
instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraKeyspaceExtractor.java
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package io.opentelemetry.javaagent.instrumentation.cassandra.v3_0;
-
-import com.datastax.driver.core.ExecutionInfo;
-import io.opentelemetry.api.common.AttributesBuilder;
-import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
-import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
-import javax.annotation.Nullable;
-
-final class CassandraKeyspaceExtractor
- implements AttributesExtractor<CassandraRequest, ExecutionInfo> {
-
- @Override
- public void onStart(AttributesBuilder attributes, CassandraRequest request) {
- attributes.put(
- SemanticAttributes.DB_CASSANDRA_KEYSPACE, request.getSession().getLoggedKeyspace());
- }
-
- @Override
- public void onEnd(
- AttributesBuilder attributes,
- CassandraRequest request,
- ExecutionInfo executionInfo,
- @Nullable Throwable error) {}
-}

MODIFY
instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraSingletons.java
instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraSingletons.java
@@ -30,7 +30,6 @@ public final class CassandraSingletons {
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, spanName)
.addAttributesExtractor(attributesExtractor)
.addAttributesExtractor(new CassandraNetAttributesExtractor())
- .addAttributesExtractor(new CassandraKeyspaceExtractor())
.newInstrumenter(SpanKindExtractor.alwaysClient());
}

MODIFY
instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy
instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy
@@ -152,7 +152,6 @@ class CassandraClientTest extends AgentInstrumentationSpecification {
"$SemanticAttributes.DB_NAME" keyspace
"$SemanticAttributes.DB_STATEMENT" statement
"$SemanticAttributes.DB_OPERATION" operation
- "$SemanticAttributes.DB_CASSANDRA_KEYSPACE" keyspace
"$SemanticAttributes.DB_CASSANDRA_TABLE" table
}
}

MODIFY
instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraAttributesExtractor.java
instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraAttributesExtractor.java
package io.opentelemetry.javaagent.instrumentation.cassandra.v4_0;
-import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.config.DefaultDriverOption;
import com.datastax.oss.driver.api.core.config.DriverExecutionProfile;
import com.datastax.oss.driver.api.core.cql.ExecutionInfo;
@@ -20,12 +19,7 @@ final class CassandraAttributesExtractor
implements AttributesExtractor<CassandraRequest, ExecutionInfo> {
@Override
- public void onStart(AttributesBuilder attributes, CassandraRequest request) {
- set(
- attributes,
- SemanticAttributes.DB_CASSANDRA_KEYSPACE,
- request.getSession().getKeyspace().map(CqlIdentifier::toString).orElse(null));
- }
+ public void onStart(AttributesBuilder attributes, CassandraRequest request) {}
@Override
public void onEnd(

MODIFY
instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy
instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy
@@ -131,7 +131,6 @@ class CassandraClientTest extends AgentInstrumentationSpecification {
"$SemanticAttributes.DB_CASSANDRA_IDEMPOTENCE" Boolean
"$SemanticAttributes.DB_CASSANDRA_PAGE_SIZE" 5000
"$SemanticAttributes.DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT" 0
- "$SemanticAttributes.DB_CASSANDRA_KEYSPACE" keyspace
// the SqlStatementSanitizer can't handle CREATE statements yet
"$SemanticAttributes.DB_CASSANDRA_TABLE" table
}

Don't extract deprecated cassandra keyspace attribute (#5041)