Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare statements support #9

Closed

Conversation

tmszdmsk
Copy link

Fixes #8.

One test case added. Under the hood it uses one of prepareAsync methods on session, I've fixed all prepare* methods though.

@malafeev malafeev self-requested a review July 16, 2018 14:47
import com.datastax.driver.core.ResultSetFuture;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.Statement;
import com.datastax.driver.core.*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't use stars in imports

Span span = buildSpan(query);
try {
PreparedStatement resultSet = session.prepare(statement);
finishSpan(span);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't span created (started) when prepared statement started to execute.
and span finished when prepared statement finished?
looks like here creation of statement is traced, but not execution.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha! you're right ;)

I will 👀 into it

@tmszdmsk
Copy link
Author

tmszdmsk commented Jul 17, 2018

After some research and debugging:

  • Mapper creates prepared statement first and uses it in the next executions
  • prepare statement span is created and has a proper parent
  • consecutive execute operations on Mapper work and have proper parent span
  • the problem is with the first operation which creates prepared statement and executes it straight away. execute operation is reported with no parent. I wasn't able to make it work.

@malafeev
Copy link

@tmszdmsk let's start from beginning.
Could you create a test which demonstrate problem you found? (Test should fail).
Then we will try to find solution.

@tmszdmsk
Copy link
Author

@malafeev, sorry for the delay

I wrote a test that demonstrates the problem, it is actually why the tests are failing:
https://travis-ci.org/opentracing-contrib/java-cassandra-driver/builds/404851120#L3429

@malafeev
Copy link

@tmszdmsk I mean what is the initial problem?
I don't think that we need to build span for prepared statement. (prepare* methods should not be changed).
Only when prepared statement is executed span should be created and finished. But it is already implemented in public ResultSet execute(Statement statement).

@tmszdmsk
Copy link
Author

@malafeev then this is the test case you want (in the first commit)
aa6bf2c

@malafeev
Copy link

malafeev commented Oct 5, 2018

I'm closing this PR because it doesn't fix the issue.
There is no proper way to propagate active span into mapper's futures.
Most likely we need to create issue against Cassandra Mapper to add such kind support.
Test is added to demonstrate issue.

@malafeev malafeev closed this Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing parent span in case of using Mapper
2 participants