cassandra table name should split out keyspace (#2177)
This commit is contained in:
parent
1f22fcaab0
commit
71ceb7486c
|
@ -131,6 +131,11 @@ public class CassandraDatabaseClientTracer extends DatabaseClientTracer<CqlSessi
|
|||
super.onStatement(span, statement);
|
||||
String table = SqlStatementSanitizer.sanitize(statement).getTable();
|
||||
if (table != null) {
|
||||
// account for splitting out the keyspace, <keyspace>.<table>
|
||||
int i = table.indexOf('.');
|
||||
if (i > -1 && i + 1 < table.length()) {
|
||||
table = table.substring(i + 1);
|
||||
}
|
||||
span.setAttribute(SemanticAttributes.DB_CASSANDRA_TABLE, table);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,8 +119,8 @@ class CassandraClientTest extends AgentInstrumentationSpecification {
|
|||
"$SemanticAttributes.DB_CASSANDRA_IDEMPOTENCE.key" Boolean
|
||||
"$SemanticAttributes.DB_CASSANDRA_PAGE_SIZE.key" 5000
|
||||
"$SemanticAttributes.DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT.key" 0
|
||||
// the SqlStatementSanitizer can't handle CREATE statements or splitting out the keyspace
|
||||
"$SemanticAttributes.DB_CASSANDRA_TABLE.key" { table -> (statement.contains("CREATE") || keyspace == null ? true : table.endsWith("users")) }
|
||||
// the SqlStatementSanitizer can't handle CREATE statements yet
|
||||
"$SemanticAttributes.DB_CASSANDRA_TABLE.key" { table -> (statement.contains("CREATE") || keyspace == null ? true : table == "users") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue