BenEddy opened a new pull request, #1810:
URL: https://github.com/apache/cassandra-gocql-driver/pull/1810

   This PR introduces `QueryInterceptor` and `BatchInterceptor` interfaces for 
intercepting queries immediately before execution, which allows clients to 
inject logic that should apply to all queries. My personal use case is 
`context` manipulation and conditionally enabling cassandra tracing, but the 
interfaces could be used for rate limiting, query modification, logging, fault 
injection, metrics, etc. 
   
   The approach here is similar to 
https://github.com/apache/cassandra-gocql-driver/issues/1786, but intercepts at 
the higher query execution level rather than the query attempt/request level. I 
like the idea of intercepting attempts, but I think the nuances of request 
handling (retry policies, speculative execution, client side host selection) 
could lead to unexpected behavior. For example, rewriting and replacing a query 
via attempt interceptor would lose query retry metrics and violate the retry 
policy. Or rate limiting a speculative execution request via attempt 
interceptor would defeat the purpose of speculative execution. However, if an 
attempt interceptor is preferred, it would not be difficult to move the 
interception point. 


-- 
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