worryg0d commented on code in PR #1941:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1941#discussion_r3063530308


##########
query_executor.go:
##########
@@ -383,17 +383,19 @@ func (q *internalQuery) attempt(keyspace string, end, 
start time.Time, iter *Ite
        if q.qryOpts.observer != nil {
                metricsForHost := q.hostMetricsManager.attempt(latency, host)
                q.qryOpts.observer.ObserveQuery(q.qryOpts.context, 
ObservedQuery{
-                       Keyspace:  keyspace,
-                       Statement: q.qryOpts.stmt,
-                       Values:    q.qryOpts.values,
-                       Start:     start,
-                       End:       end,
-                       Rows:      iter.numRows,
-                       Host:      host,
-                       Metrics:   metricsForHost,
-                       Err:       iter.err,
-                       Attempt:   attempt,
-                       Query:     q.originalQuery,
+                       Keyspace:          keyspace,
+                       Statement:         q.qryOpts.stmt,
+                       StatementKeyspace: q.routingInfo.getKeyspace(),

Review Comment:
   `routingInfo` could not have any information about keyspaces/tables for DDL 
queries that are unprepareable, so you probably should use 
`internalQuery.Keyspace()` here. It has some predefined defaulting behavior.
   
   We should probably think about adding a kind of parsing of DDL queries to 
determine keyspace and table names from it before defaulting to session-level 
keyspace. 
   
   Also, there is an alternative for `internalBatch.Keyspace()` as well, but it 
just calls the underlying routingInfo, which is fine because it is impossible 
to batch DDL queries.
   
   @joao-r-reis, could you please take a look at this?



##########
session.go:
##########
@@ -2374,6 +2374,14 @@ type ObservedQuery struct {
        Keyspace  string
        Statement string
 
+       // StatementKeyspace is the keyspace of the table targeted by the query.
+       // It is populated from prepared statement metadata returned by 
Cassandra.
+       StatementKeyspace string

Review Comment:
   I think it is fine to populate the existing `Keyspace` field here - it is 
unclear to see the difference between `Keyspace` and `StatementKeyspace`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to