Skip to content

Commit

Permalink
Add attempt to query observer (apache#1157)
Browse files Browse the repository at this point in the history
  • Loading branch information
annismckenzie authored and Zariel committed Aug 20, 2018
1 parent 21621ec commit 153a728
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ func (q *Query) attempt(keyspace string, end, start time.Time, iter *Iter, host
Rows: iter.numRows,
Host: host,
Err: iter.err,
Attempt: q.attempts,
})
}
}
Expand Down Expand Up @@ -1544,8 +1545,9 @@ func (b *Batch) attempt(keyspace string, end, start time.Time, iter *Iter, host
Start: start,
End: end,
// Rows not used in batch observations // TODO - might be able to support it when using BatchCAS
Host: host,
Err: iter.err,
Host: host,
Err: iter.err,
Attempt: b.attempts,
})
}

Expand Down Expand Up @@ -1700,6 +1702,9 @@ type ObservedQuery struct {
// Err is the error in the query.
// It only tracks network errors or errors of bad cassandra syntax, in particular selects with no match return nil error
Err error

// Attempt contains the number of times the query has been attempted so far.
Attempt int
}

// QueryObserver is the interface implemented by query observers / stat collectors.
Expand All @@ -1725,6 +1730,9 @@ type ObservedBatch struct {
// Err is the error in the batch query.
// It only tracks network errors or errors of bad cassandra syntax, in particular selects with no match return nil error
Err error

// Attempt contains the number of times the query has been attempted so far.
Attempt int
}

// BatchObserver is the interface implemented by batch observers / stat collectors.
Expand Down

0 comments on commit 153a728

Please sign in to comment.