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

Raphael/gocql #73

Merged
merged 6 commits into from
Jun 19, 2017
Merged

Raphael/gocql #73

merged 6 commits into from
Jun 19, 2017

Conversation

raphaelgavache
Copy link
Contributor

@raphaelgavache raphaelgavache commented Jun 1, 2017

Gocql query wrapper

Implementation:

After creating your query, wrap it with a function for it to be traced
query := session.Query("my-query ...")
traced_query = gocqltrace.TraceQuery("Service name", Tracer, query)

Data we get 100% time: query, errors, row count, pagestate
Data we only get when the query returns columns: keyspace
Data we will get once this is merged gocql/gocql#918 : host, port, clustername

screen shot 2017-06-02 at 4 14 44 pm


// TraceQuery wraps a gocql.Query into a TracedQuery
func TraceQuery(service string, tracer *tracer.Tracer, q *gocql.Query) *TracedQuery {
string_query := strings.SplitN(q.String(), "\"", 3)[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

No snake_case !!! 😠

Copy link
Contributor

Choose a reason for hiding this comment

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

😨

service string
keyspace string
paginated string
consistancy string
Copy link
Contributor

Choose a reason for hiding this comment

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

consistency


// TraceQuery wraps a gocql.Query into a TracedQuery
func TraceQuery(service string, tracer *tracer.Tracer, q *gocql.Query) *TracedQuery {
string_query := strings.SplitN(q.String(), "\"", 3)[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this split doing exactly? seems very opaque. Can you add a test describing the behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

q.String() returns for a query: (exemple) [query statement="SELECT * from trace.person" values=[] consistency=QUORUM]
So in between the two first " there's the query

Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't work - I'm getting "Non-parsable SQL query" - add a test

// TraceQuery wraps a gocql.Query into a TracedQuery
func TraceQuery(service string, tracer *tracer.Tracer, q *gocql.Query) *TracedQuery {
string_query := strings.SplitN(q.String(), "\"", 3)[1]
q.NoSkipMetadata()
Copy link
Contributor

Choose a reason for hiding this comment

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

what does NoSkipMetadata do?

@vlad-mh
Copy link
Contributor

vlad-mh commented Jun 19, 2017

We've been using this version prod for a couple of days now. Looking fine.

Copy link
Member

@ufoot ufoot left a comment

Choose a reason for hiding this comment

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

LGTM

@ufoot ufoot merged commit 555b8a1 into master Jun 19, 2017
ufoot added a commit that referenced this pull request Jun 19, 2017
This contains two PRs:

- #73 branch raphael/gocql (Cassandra support)
- #78 branch christian/flushchannel (fix partial traces bug)

Those 2 branches had conflicts, and the commit 6952e85 fixes
the interactions between them. Additionnally, it has been running
for 3 complete days on our prod env, so considered stable enough.
@ufoot ufoot added this to the 0.5.0 milestone Jun 19, 2017
@raphaelgavache raphaelgavache deleted the raphael/gocql branch June 20, 2017 15:19
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.

None yet

4 participants