openzipkin / brave-cassandra

Tracing instrumentation for Cassandra and the DataStax Java Driver
Apache License 2.0
12 stars 14 forks source link

Capture raw query details #28

Open jake-codes opened 5 years ago

jake-codes commented 5 years ago

It would be an excellent addition to have the raw query details captured in the trace. An example of this can be found in Last Pickle's implementation.

codefromthecrypt commented 5 years ago

i think we do similar in mysql though obviously can be big.

client side, cassandra side or both?

On Wed, Oct 23, 2019, 8:41 AM jake-codes notifications@github.com wrote:

It would be an excellent addition to have the raw query details captured in the trace. An example of this can be found in Last Pickle's https://github.com/thelastpickle/cassandra-zipkin-tracing implementation.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openzipkin/brave-cassandra/issues/28?email_source=notifications&email_token=AAAPVV2NFPZCEHAYO3YFJ33QP6MSVA5CNFSM4JD2GTL2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HTVKAOQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAPVV7WCAIJ4KWH4MA6LFLQP6MSVANCNFSM4JD2GTLQ .

jake-codes commented 5 years ago

Both would be ideal but either would still be helpful.

codefromthecrypt commented 5 years ago

@llinder @michaelsembwever I will presume you are ok with this heh. we can always do something different later also.

@jake-codes are you up to doing the pull request?

llinder commented 5 years ago

Makes sense to me and I think we actually do this internally for some services. My only point of caution is that, while it's neat to see the query, it probably doesn't justify the extra storage costs for high traffic sites. Unless we support some form of deduplication of tags, I don't know that there is a good solution for that besides adding some config to the instrumentation so folks can disable these extra tags.

codefromthecrypt commented 5 years ago

hmm we set the tag "cassandra.request" same as the link you mentioned.. https://github.com/thelastpickle/cassandra-zipkin-tracing/blob/master/src/main/java/com/thelastpickle/cassandra/tracing/ZipkinTracing.java#L146

codefromthecrypt commented 5 years ago

we also tag the query client side if it is a bound statement

    if (statement instanceof BoundStatement) {
      customizer.tag(
          CassandraTraceKeys.CASSANDRA_QUERY,
          ((BoundStatement) statement).preparedStatement().getQueryString());
    }
codefromthecrypt commented 5 years ago

I will be offline for a while, so if there's more follow-up I'd recommend whoever does to proceed with failing unit tests so that we aren't solving things already solved.